public void Remove(Character c, GearItem item) { c.strength.RemoveAllFromSource(item); c.health.RemoveAllFromSource(item); c.stamina.RemoveAllFromSource(item); c.speed.RemoveAllFromSource(item); }
private UnityAction UnequipGearItemUi(GearItem item) { return(() => { GameManager.Instance.Player.characterData.Unequip(item); var slotName = item.type + "Slot"; var slot = equipmentBar.transform.Find(slotName); var itemImage = slot.gameObject.transform.Find("Slot").transform.Find("Item").GetComponent <Image>(); itemImage.enabled = false; slot.transform.Find("Cross").GetComponent <Button>().onClick.RemoveAllListeners(); }); }
private UnityAction EquipGearItemUi(GearItem item, Sprite sprite) { return(() => { if (GameManager.Instance.Player.characterData.EquipItem(item)) { var slotName = item.type + "Slot"; var slot = equipmentBar.transform.Find(slotName); var itemImage = slot.gameObject.transform.Find("Slot").transform.Find("Item").GetComponent <Image>(); itemImage.sprite = sprite; itemImage.enabled = true; slot.transform.Find("Cross").GetComponent <Button>().onClick.AddListener(UnequipGearItemUi(item)); } }); }
public void Apply(Character c, GearItem item) { if (item.bonus != null) { switch (item.bonus.type) { case BonusType.Health: c.health.Add(new AttributeModifier(item.bonus.value, item.bonus.scaler, item)); break; case BonusType.Stamina: c.stamina.Add(new AttributeModifier(item.bonus.value, item.bonus.scaler, item)); break; case BonusType.Strength: c.strength.Add(new AttributeModifier(item.bonus.value, item.bonus.scaler, item)); break; case BonusType.Speed: c.speed.Add(new AttributeModifier(item.bonus.value, item.bonus.scaler, item)); break; } } }