Beispiel #1
0
    public bool HasBudgetToBuy(Buyables objectToBuy, int cantidad)
    {
        int totalPrice = 0;

        if (objectToBuy == Buyables.SolarPanel)
        {
            totalPrice = GetTotalPriceSolarPanel(cantidad);
        }

        if (objectToBuy == Buyables.OxygenExtractor)
        {
            totalPrice = GetTotalPriceOxygenExtractor(cantidad);
        }

        if (objectToBuy == Buyables.MicrowaveAntenna)
        {
            totalPrice = GetTotalPriceMicrowaveAntenna(cantidad);
        }

        if (objectToBuy == Buyables.SolarPanelFactory)
        {
            totalPrice = GetTotalPriceSolarPanelFactorry(cantidad);
        }

        if (objectToBuy == Buyables.MineralExtractor)
        {
            totalPrice = GetTotalPriceMineralExtractor(cantidad);
        }

        return totalPrice <= this.Budget;
    }
Beispiel #2
0
    public void DiscountTotalPrice(Buyables objectToBuy, int cantidad)
    {
        int totalPrice = 0;

        if (objectToBuy == Buyables.SolarPanel)
        {
            totalPrice = GetTotalPriceSolarPanel(cantidad);
        }

        if (objectToBuy == Buyables.OxygenExtractor)
        {
            totalPrice = GetTotalPriceOxygenExtractor(cantidad);
        }

        if (objectToBuy == Buyables.MicrowaveAntenna)
        {
            totalPrice = GetTotalPriceMicrowaveAntenna(cantidad);
        }

        if (objectToBuy == Buyables.SolarPanelFactory)
        {
            totalPrice = GetTotalPriceSolarPanelFactorry(cantidad);
        }
        if (objectToBuy == Buyables.MineralExtractor)
        {
            totalPrice = GetTotalPriceMineralExtractor(cantidad);
        }

        this.Budget -= totalPrice;
    }
    public bool Buy(Buyables objectToBuy, int cantidad)
    {
        if (objectToBuy == Buyables.MicrowaveAntenna || objectToBuy == Buyables.OxygenExtractor)
        {
            if (this.BuyingInventory[objectToBuy] >= 1)
            {
                return false;
            }
        }
        bool canBuy = this.Player.HasBudgetToBuy(objectToBuy, cantidad);
        bool hasPrerequisites = this.Player.HasPrerequisites(objectToBuy, cantidad);

        if (canBuy && hasPrerequisites)
        {
            this.BuyingInventory[objectToBuy] += cantidad;

            this.Player.DiscountTotalPrice(objectToBuy, cantidad);
        }

        return canBuy;
    }
    public void UpdateAmountInInventory(Buyables objectToUpdate, int amount)
    {
        this.Inventory[objectToUpdate] += amount;

        if (this.Inventory[objectToUpdate] < 0)
        {
            this.Inventory[objectToUpdate] = 0;
        }
    }
 public bool HasInInventory(Buyables objectToVerify)
 {
     return this.Inventory[objectToVerify] > 0;
 }
 public int GetInventoryAmountOf(Buyables objectToBuy)
 {
     return this.Inventory[objectToBuy];
 }
 public int GetBuyingAmountOf(Buyables objectToBuy)
 {
     return this.BuyingInventory[objectToBuy];
 }
Beispiel #8
0
    public void RestoreTotalPrice(Buyables objectToBuy, int cantidad)
    {
        int totalPrice = 0;

        if (objectToBuy == Buyables.SolarPanel)
        {
            totalPrice = GetTotalPriceSolarPanel(cantidad);
        }

        if (objectToBuy == Buyables.OxygenExtractor)
        {
            totalPrice = GetTotalPriceOxygenExtractor(cantidad);
        }

        if (objectToBuy == Buyables.MicrowaveAntenna)
        {
            totalPrice = GetTotalPriceMicrowaveAntenna(cantidad);
        }

        this.Budget += totalPrice;
    }
Beispiel #9
0
 public bool HasPrerequisites(Buyables objectToBuy, int cantidad)
 {
     //TODO: Implement!
     return true;
 }