예제 #1
0
        public void add(Entity entity)
        {
            entityContainer.AddEntity(entity);

            Iweight iweight = (Iweight)entity;

            // Updating inventory's current weight
            currentWeight += iweight.getWeightValue();

            Console.WriteLine(entity.name + " added to inventory.");
        }
        public void sellShop(Iprice iprice)
        {
            // Check if item is in shop
            Entity itemToSell = (Entity)iprice;

            bool isInInventory = inventory.entityContainer.checkIfInList(itemToSell.name);

            if (isInInventory == true)
            {
                Console.WriteLine(itemToSell.name + " sold to shop for " + iprice.getPriceValue() + " gold coins.");

                // remove from inventory
                inventory.removeFromInventory(itemToSell);

                // Add to shop
                entityContainer.AddEntity(itemToSell);

                // Give to money to the player
                inventory.money += iprice.getPriceValue();
            }
        }