public static void PlaceItem(Point location) { if (itemToPlace != null && IsClear(location)) { Item newItem = itemToPlace.BaseItem.CreateNewItem(); newItem.SetLocation(location); AddEntity(newItem); newItem.ActionOnPlace(location); RemoveItemFromInventory(itemToPlace); itemToPlace = null; } }
public static void RemoveItemFromInventory(ShopItem item) { if (inventory.ContainsKey(item) && --inventory[item] <= 0) { inventory.Remove(item); } }
public static void AddItemToInventory(ShopItem item) { if (!inventory.ContainsKey(item)) { inventory[item] = 0; } inventory[item]++; }