public void execute()
        {
            if (Warcraft.GOLD - building.information.CostGold >= 0 && Warcraft.WOOD - building.information.CostWood >= 0)
            {
                Warcraft.GOLD -= building.information.CostGold;
                Warcraft.WOOD -= building.information.CostWood;

                if ((building.information as InformationBuilding).Type == Util.Buildings.CHICKEN_FARM)
                {
                    Warcraft.FOOD += 5;
                }

                builder.workState = WorkigState.WAITING_PLACE;
                building.builder();
            }
        }
예제 #2
0
        public bool execute()
        {
            if (ManagerResources.CompareGold(managerUnits.index, building.information.CostGold)) // && ManagerResources.CompareFood(managerUnits.index, building.information.CostWood))
            {
                ManagerResources.ReduceGold(managerUnits.index, building.information.CostGold);

                if ((building.information as InformationBuilding).Type == Util.Buildings.CHICKEN_FARM ||
                    (building.information as InformationBuilding).Type == Util.Buildings.PIG_FARM)
                {
                    ManagerResources.ReduceFood(managerUnits.index, -5);
                }

                builder.workState = WorkigState.WAITING_PLACE;
                building.builder();

                return(true);
            }

            return(false);
        }