Exemple #1
0
 /// <summary>
 /// Remove item from inventory
 /// </summary>
 private Status RemoveItemFromInventory(Item item)
 {
     Inventory.Status res = mInventory.RemoveItem(item);
     if (res == Inventory.Status.RemoveOK)
     {
         return(Status.DestoryOK);
     }
     else
     {
         return(Status.DestoryError);
     }
 }
Exemple #2
0
    /// <summary>
    /// Buy Item
    /// </summary>
    public Status BuyItem(Item item)
    {
        if (item.mType == Item.ItemType.CanNotBuy)
        {
            return(Status.BuyError_ItemCanNotBuy);
        }

        if (item.mSellPrize > mGold)
        {
            return(Status.BuyError_NotEnoughGold);
        }

        Inventory.Status res = mInventory.AddItem(item);
        if (res == Inventory.Status.AddOK)
        {
            mGold -= item.mBuyPrize;
            return(Status.BuyOK);
        }
        else
        {
            return(Status.BuyError);
        }
    }