Exemple #1
0
 public void SellInventoryDisplay(Player player, Shopkeeper shopKeeper)
 {
     for (int i = 0; i < Global.playerInventorySlotAmount; i++)
     {
         if (slots[i] == null)
         {
             Console.WriteLine("Inventory slot " + (i + 1) + ": ");
         }
         else
         {
             Console.WriteLine("Inventory slot " + (i + 1) + ": " + slots[i].itemType);
         }
     }
 }
Exemple #2
0
        public Shop(int shopCenterX, int shopCenterY, int shopWidth, int shopHeight, bool isShopVertical, int amountOfItems, ItemManager itemManager, Player playerReference, Camera cam, Inventory inventoryReference, EnemyManager enemyManagerReference)
        {
            isShopOpen   = true;
            player       = playerReference;
            camera       = cam;
            inventory    = inventoryReference;
            enemyManager = enemyManagerReference;
            xLoc         = shopCenterX;
            yLoc         = shopCenterY;

            shopKeeper = new Shopkeeper(shopCenterX, shopCenterY, player, this);
            shopKeeper.SetMoney(Global.shopStartingMoney);
            if (isShopVertical)
            {
                for (int x = 0; x < amountOfItems; x++)
                {
                    CreateItem((shopCenterX - shopWidth) + x, (shopCenterY - shopHeight));
                    newItem.SetShopItem(true);
                    newItem.SetPrice(rand.Next(Global.shopPriceMin, Global.shopPriceMax));
                    newItem.SetPosition((shopCenterX - shopWidth) + x, (shopCenterY - shopHeight));
                    newItem.SetShop(this);
                    itemManager.AddShopItem(newItem);
                }
            }
            else
            {
                for (int x = 0; x < amountOfItems; x++)
                {
                    CreateItem((shopCenterX - shopWidth), (shopCenterY - shopHeight) + x);
                    newItem.SetShopItem(true);
                    newItem.SetPrice(rand.Next(Global.shopPriceMin, Global.shopPriceMax));
                    newItem.SetPosition((shopCenterX - shopWidth), (shopCenterY - shopHeight) + x);
                    newItem.SetShop(this);
                    itemManager.AddShopItem(newItem);
                }
            }
        }