Ejemplo n.º 1
0
    //Method called from buttons
    public void DoBuildingAction(B_Actions action, int bIndex)
    {
        float priceOfAction = 0;

        switch (action)
        {
        case B_Actions.UPGRADE:
            priceOfAction = edificiosDelRecinto[bIndex].GetUpgradePrice();
            if (ResourceController.CheckIfEnoughMoney(priceOfAction))
            {
                edificiosDelRecinto[bIndex].Upgrade();
            }
            break;

        case B_Actions.BUY_EMPLOYEE:
            if (bIndex < 0)
            {
                BuyEmployee();
                break;
            }
            edificiosDelRecinto[bIndex].BuyEmployee();

            break;

        case B_Actions.FIRE_EMPLOYEE:
            if (bIndex < 0)
            {
                FireEmployee();
                break;
            }
            edificiosDelRecinto[bIndex].FireEmployee();
            break;

        case B_Actions.REPAIR:
            priceOfAction = edificiosDelRecinto[bIndex].GetPriceEmployee();
            if (ResourceController.CheckIfEnoughMoney(priceOfAction))
            {
                edificiosDelRecinto[bIndex].Repair();
            }
            break;

        default:
            break;
        }
    }