public void EquipBoots(ItemClass item)
    {
        // If a shield is held
        if (wornBoots != null)
        {   // Add current offhand to inventory
            InventoryManager.instance.AddItemToInventory(currentEquippedBoots.itemSlug);
            // Remove offhand stats from player stats
            combatantStats.RemoveStatBoost(wornBoots.GetComponent <IBoots>().Stats);
            // Destroy offhand being held
            Destroy(feet.transform.GetChild(0).gameObject); // Destroys first child of mainHand, which would be offhand held
        }
        // Equip new offhand
        wornBoots = (GameObject)Instantiate(Resources.Load <GameObject>("Items/Boots/" + item.itemSlug), feet.transform.position, feet.transform.rotation); // Finds prefab in resources folder with the same item slug and instantiates it on the main hand

        // Get offhand interface from the held offhand
        equippedBoots = wornBoots.GetComponent <IBoots>();

        // Set new offhand stats
        equippedBoots.Stats = item.stats;
        // Set offhand position to mainhand
        wornBoots.transform.SetParent(feet.transform);
        // Set stats for equipped offhand
        equippedBoots.Stats = item.stats;
        // Set current offhand to new offhand
        currentEquippedBoots = item;
        // Add offhand stats to player
        combatantStats.AddStatBoost(item.stats);
        // Pass item being equipped to UIManager
        UIManager.FeetWorn(item);
        UIManager.StatsChanged();
    }
示例#2
0
 /// <summary>
 /// Equips target boots
 /// </summary>
 /// <devnote>
 /// Custom equipment setter.
 /// Created to have more control on what's going on.
 /// </devnote>
 public void EquipBoots(IBoots boots, bool unequip = false)
 {
     if (!unequip)
     {
         Boots = boots;
     }
     else if (Boots?.Name == boots.Name)
     {
         Boots = default;
     }
 }
示例#3
0
        public void DestroyItem(string itemForDestruction)
        {
            switch (itemForDestruction)
            {
            case "weapon":
                Toolbar.SystemMsg.Instance.AllMessages.Add(new Dictionary <string, Color>()
                {
                    { String.Format(">> {0} destroyed.", this.Weapon.Name), Color.Red }
                });
                this.Weapon = null;
                break;

            case "shield":
                Toolbar.SystemMsg.Instance.AllMessages.Add(new Dictionary <string, Color>()
                {
                    { String.Format(">> You destroyed {0}.", this.Shield.Name), Color.Red }
                });
                this.Shield = null;
                break;

            case "gloves":
                Toolbar.SystemMsg.Instance.AllMessages.Add(new Dictionary <string, Color>()
                {
                    { String.Format(">> You destroyed {0}.", this.Gloves.Name), Color.Red }
                });
                this.Gloves = null;
                break;

            case "robe":
                Toolbar.SystemMsg.Instance.AllMessages.Add(new Dictionary <string, Color>()
                {
                    { String.Format(">> You destroyed {0}.", this.Robe.Name), Color.Red }
                });
                this.Robe = null;
                break;

            case "boots":
                Toolbar.SystemMsg.Instance.AllMessages.Add(new Dictionary <string, Color>()
                {
                    { String.Format(">> You destroyed {0}.", this.Boots.Name), Color.Red }
                });
                this.Boots = null;
                break;

            case "helmet":
                Toolbar.SystemMsg.Instance.AllMessages.Add(new Dictionary <string, Color>()
                {
                    { String.Format(">> You destroyed {0}.", this.Helmet.Name), Color.Red }
                });
                this.Helmet = null;
                break;
            }
        }
示例#4
0
 public void BuyItem(Interfaces.IItem newItem, int coinsSpent)
 {
     if (coinsSpent <= this.Coins.Amount)
     {
         if (newItem.ToString().Contains("Elixir"))
         {
             CompleteTransaction(newItem, coinsSpent);
             this.Elixirs = (Items.ElixirsHP)newItem;
         }
         else if (newItem.ToString().Contains("Boots"))
         {
             if (this.Boots != null)
             {
                 Toolbar.SystemMsg.Instance.AllMessages.Add(new Dictionary <string, Color>()
                 {
                     { String.Format(">> First destroy your Boots!"), Color.Red }
                 });
             }
             else
             {
                 CompleteTransaction(newItem, coinsSpent);
                 this.Boots = (Interfaces.IBoots)newItem;
             }
         }
         else if (newItem.ToString().Contains("Gloves"))
         {
             if (this.Gloves != null)
             {
                 Toolbar.SystemMsg.Instance.AllMessages.Add(new Dictionary <string, Color>()
                 {
                     { String.Format(">> First destroy your Gloves!"), Color.Red }
                 });
             }
             else
             {
                 CompleteTransaction(newItem, coinsSpent);
                 this.Gloves = (Interfaces.IGloves)newItem;
             }
         }
         else if (newItem.ToString().Contains("Helmet"))
         {
             if (this.Helmet != null)
             {
                 Toolbar.SystemMsg.Instance.AllMessages.Add(new Dictionary <string, Color>()
                 {
                     { String.Format(">> First destroy your Helmet!"), Color.Red }
                 });
             }
             else
             {
                 CompleteTransaction(newItem, coinsSpent);
                 this.Helmet = (Interfaces.IHelmet)newItem;
             }
         }
         else if (newItem.ToString().Contains("Robe"))
         {
             if (this.Robe != null)
             {
                 Toolbar.SystemMsg.Instance.AllMessages.Add(new Dictionary <string, Color>()
                 {
                     { String.Format(">> First destroy your Robe!"), Color.Red }
                 });
             }
             else
             {
                 CompleteTransaction(newItem, coinsSpent);
                 this.Robe = (Interfaces.IRobe)newItem;
             }
         }
         else if (newItem.ToString().Contains("Shield"))
         {
             if (this.Shield != null)
             {
                 Toolbar.SystemMsg.Instance.AllMessages.Add(new Dictionary <string, Color>()
                 {
                     { String.Format(">> First destroy your Shield!"), Color.Red }
                 });
             }
             else
             {
                 CompleteTransaction(newItem, coinsSpent);
                 this.Shield = (Interfaces.IShield)newItem;
             }
         }
         else if (newItem.ToString().Contains("Weapon"))
         {
             if (this.Weapon != null)
             {
                 Toolbar.SystemMsg.Instance.AllMessages.Add(new Dictionary <string, Color>()
                 {
                     { String.Format(">> First destroy your Weapon!"), Color.Red }
                 });
             }
             else
             {
                 CompleteTransaction(newItem, coinsSpent);
                 this.Weapon = (Interfaces.IWeapon)newItem;
             }
         }
     }
     else
     {
         Toolbar.SystemMsg.Instance.AllMessages.Add(new Dictionary <string, Color>()
         {
             { ">> Not enough coins.", Color.Red }
         });
     }
 }