Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a weapon synthesis system, including the EquipmentManager for synthesis logic, the Slot class for UI management, and updates to the SO_Weapon data structure. The review feedback highlights critical IndexOutOfRangeException risks when handling maximum-level weapons in both the UI refresh and synthesis methods. Additionally, a bug was identified in the synthesis condition that prevents processing when the exact required material count is met, and a recommendation was made to simplify UI calculation logic to avoid potential floating-point inaccuracies and improve readability.
| weaponBackgroundImage[i].color = weaponLevelColor[weaponLevelValue + i]; | ||
| weaponSlotImage[i].sprite = weaponArray[weaponTypeValue] | ||
| .weapons[weaponLevelValue + i] | ||
| .weaponIcon; |
| { | ||
| weaponArray[weaponTypeValue].weapons[weaponLevelValue].weaponCount -= | ||
| (uint)synthesisCount * 5; | ||
| GetItem(weaponTypeValue, weaponLevelValue + 1, (uint)synthesisCount); |
| .weaponIcon; | ||
| string hexColor = "#" + ColorUtility.ToHtmlStringRGB(synthesisColor[i]); | ||
| weaponCountText[i].text = | ||
| $"{weaponArray[weaponTypeValue].weapons[weaponLevelValue + i].weaponCount}(<color={hexColor}>{synthesisCount * 5 * (i == 0 ? -1 : (1 / 5f))}</color>)"; |
|
|
||
| public void Synthesis() | ||
| { | ||
| if (synthesisCount * 5 < weaponArray[weaponTypeValue].weapons[weaponLevelValue].weaponCount) |
There was a problem hiding this comment.
WeaponLevel enum에서 C가 D보다 높게 쓰여있는 이유가 있을까요?
| @@ -24,13 +23,15 @@ public enum WeaponType | |||
| public class SO_Weapon : ScriptableObject | |||
| { | |||
There was a problem hiding this comment.
SO_Weapon클래스에서 WeaponId라는 속성을 추가로 넣는 것을 권장 드립니다
There was a problem hiding this comment.
WeaponID 부분과 같은 것들은 장비 탭을 만들 때 넣을 예정입니다
|
|
||
| public class EquipmentManager : MonoBehaviour | ||
| { | ||
| public static EquipmentManager Instance { get; private set; } |
There was a problem hiding this comment.
Instance프로퍼티에는 더 철저한 예외 처리가 필요합니다. Awake문에서 초기화를 한다고 해도 먼저 실행된 다른 Awake문이 있을 수도 있기 때문입니다
| public Image[] weaponBackgroundImage; | ||
| public Image[] weaponSlotImage; | ||
| public Text[] weaponCountText; | ||
| public Text synthesisCountText; |
There was a problem hiding this comment.
윗부분은 카멜 케이스인데 여기 부분만 파스칼 케이스로 쓴 이유가 있을까요?
There was a problem hiding this comment.
평소 명명규칙을 생각하지 않고 변수를 생성해서 생긴 문제 같습니다 명명규칙을 지켜서 작성하도록 하겠습니다
| private Sprite WeaponIcon; | ||
| public Sprite weaponIcon => WeaponIcon; |
There was a problem hiding this comment.
일반적으로 private 속성은 카멜 케이스, public 속성은 파스칼 케이스를 사용하는게 맞습니다.
No description provided.