public Equip(int id, int lv = 1) { ItemData.RootObject itemData = ItemData.GetData(id); EquipData.RootObject equipData = EquipData.GetData(id); if (itemData != null && equipData != null) { ID = id; Name = itemData.GetName(); Lv = lv; if (lv > 1) { Name += "+" + (Lv - 1); } Comment = itemData.GetComment(); Icon = itemData.Icon; Volume = itemData.Volume; Price = itemData.Price; Amount = 1; CanCook = itemData.CanCook; CanBeStacked = itemData.CanBeStacked; Type = itemData.Type; EquipType = equipData.Type; ATK = Mathf.RoundToInt(equipData.ATK * (1 + (Lv - 1) * 0.1f)); DEF = Mathf.RoundToInt(equipData.DEF * (1 + (Lv - 1) * 0.1f)); MTK = Mathf.RoundToInt(equipData.MTK * (1 + (Lv - 1) * 0.1f)); MEF = Mathf.RoundToInt(equipData.MEF * (1 + (Lv - 1) * 0.1f)); UpgradePrice = equipData.UpgradePrice; } else { Debug.Log("裝備資料不存在!"); } }
public void SetData(int id) { EquipData.RootObject data = EquipData.GetData(id); ATKLabel.text = data.ATK.ToString(); ATKLabel.transform.parent.gameObject.SetActive(data.ATK != 0); DEFLabel.text = data.DEF.ToString(); DEFLabel.transform.parent.gameObject.SetActive(data.DEF != 0); MTKLabel.text = data.MTK.ToString(); MTKLabel.transform.parent.gameObject.SetActive(data.MTK != 0); MEFLabel.text = data.MEF.ToString(); MEFLabel.transform.parent.gameObject.SetActive(data.MEF != 0); }
public void LvUp() { ItemData.RootObject itemData = ItemData.GetData(ID); EquipData.RootObject equipData = EquipData.GetData(ID); if (Lv < MaxLv) { Lv += 1; } Name = itemData.GetName(); Name += "+" + (Lv - 1); ATK = Mathf.RoundToInt(equipData.ATK * (1 + (Lv - 1) * 0.1f)); DEF = Mathf.RoundToInt(equipData.DEF * (1 + (Lv - 1) * 0.1f)); MTK = Mathf.RoundToInt(equipData.MTK * (1 + (Lv - 1) * 0.1f)); MEF = Mathf.RoundToInt(equipData.MEF * (1 + (Lv - 1) * 0.1f)); }