Esempio n. 1
0
 public void Remove(Character c, GearItem item)
 {
     c.strength.RemoveAllFromSource(item);
     c.health.RemoveAllFromSource(item);
     c.stamina.RemoveAllFromSource(item);
     c.speed.RemoveAllFromSource(item);
 }
Esempio n. 2
0
        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();
            });
        }
Esempio n. 3
0
        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));
                }
            });
        }
Esempio n. 4
0
        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;
                }
            }
        }