GetItemName() public method

public GetItemName ( ) : string
return string
Ejemplo n.º 1
0
    ///<summary>
    /// Attempts to put GameItem 'item' as an equipped item on the player
    ///</summary>
    public void Equip(GameItem item)
    {
        if (item is HeadItem)
        {
            inventory.Remove(item);
            if (GetHelmet() != null)
            {
                inventory.Add(GetHelmet());
            }
            SetHelmet((HeadItem)item);
        }
        else if (item is ChestItem)
        {
            inventory.Remove(item);
            if (GetChest() != null)
            {
                inventory.Add(GetChest());
            }
            SetChest((ChestItem)item);
        }
        else if (item is LegItem)
        {
            inventory.Remove(item);
            if (GetLegs() != null)
            {
                inventory.Add(GetLegs());
            }
            SetLegs((LegItem)item);
        }
        else if (item is WeaponItem)
        {
            inventory.Remove(item);
            if (GetWeapon() != null)
            {
                inventory.Add(GetWeapon());
            }
            SetWeapon((WeaponItem)item);
        }
        else
        {
            throw new Exception("Don't know how to equip " + item.GetType() + " " + item.GetItemName() + " Yet!");
        }

        CheckLevelReq();
    }
Ejemplo n.º 2
0
    ///<summary>
    /// Attempts to put GameItem 'item' as an equipped item on the player
    ///</summary>
    public void Equip(GameItem item)
    {
        if (item is HeadItem)
        {
            inventory.Remove(item);
            if (GetHelmet() != null)
            {
                inventory.Add(GetHelmet());
            }
            SetHelmet((HeadItem)item);
        }
        else if (item is ChestItem)
        {
            inventory.Remove(item);
            if (GetChest() != null)
            {
                inventory.Add(GetChest());
            }
            SetChest((ChestItem)item);
        }
        else if (item is LegItem)
        {
            inventory.Remove(item);
            if (GetLegs() != null)
            {
                inventory.Add(GetLegs());
            }
            SetLegs((LegItem)item);
        }
        else if (item is WeaponItem)
        {
            inventory.Remove(item);
            if (GetWeapon() != null)
            {
                inventory.Add(GetWeapon());
            }
            SetWeapon((WeaponItem)item);
        }
        else
        {
            throw new Exception("Don't know how to equip " + item.GetType() + " " + item.GetItemName() +" Yet!");
        }

        CheckLevelReq();
    }