public void addItem(Item item) { Debug.Log("This got called"); StatModifier armorMod = new StatModifier(item.armor, item.statModType, item.armorType);; StatModifier healthMod = new StatModifier(item.health, item.statModType, item.healthType); StatModifier damageMod = new StatModifier(item.damage, item.statModType, item.damageType); HealthStat health = statController.GetStatOfType(StatType.HealthStat) as HealthStat; ArmorStat armor = statController.GetStatOfType(StatType.ArmorStat) as ArmorStat; DamageStat damage = statController.GetStatOfType(StatType.DamageStat) as DamageStat; statController.AddModifier(healthMod); statController.AddModifier(armorMod); statController.AddModifier(damageMod); Debug.Log("Health total is " + health.CalculateFinalValue()); Debug.Log("Damage total is " + damage.CalculateFinalValue()); Debug.Log("Armor total is " + armor.CalculateFinalValue()); items[(int)item.equipmentSlot] = item; for (int i = 0; i < equipmentUISlots.Length; i++) { if (item.equipmentSlot == equipmentUISlots[i].equipmentSlot) { equipmentUISlots[i].addItem(item); } } }
public void Equip(StatControler statControler) { foreach (modInfo mod in modifiers) { statControler.AddModifier(new StatModifier(mod.value, mod.type, mod.statType, this)); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision == playerCollider) { //PlayerAction.instance.heldItem.damage += damageUp; StatModifier damageMod = new StatModifier(damageUp, StatModType.Flat, StatType.DamageStat); playerSC.AddModifier(damageMod); Destroy(gameObject); } }