Пример #1
0
    private void RemoveResources()
    {
        if (build.tag == "TownHall")
        {
            resource.RemoveWood(townHallCostWood);
            resource.RemoveGold(townHallCostGold);
            resource.AddTownHall();
        }
        else if (build.tag == "Castle")
        {
            resource.RemoveWood(castleCostWood);
            resource.RemoveGold(castleCostWood);
            resource.AddCastle();
        }
        else if (build.tag == "House")
        {
            resource.RemoveWood(houseCostWood);
            resource.RemoveGold(houseCostGold);
            resource.AddMaxPop(4);
            resource.AddCurrentPop(4);
            resource.AddHouse();
        }
        else if (build.tag == "Farm")
        {
            resource.RemoveWood(farmCostWood);
            resource.AddFarm();
            resource.RemoveCurrentPop(2);
            resource.AddNonIdlePop(2);
        }
        else if (build.tag == "LumberMill")
        {
            resource.RemoveWood(lumbMillCostWood);
            resource.AddLumberMill();
            resource.RemoveCurrentPop(4);
            resource.AddNonIdlePop(4);
        }
        else if (build.tag == "GoldMine")
        {
            resource.RemoveWood(mineCostWood);
            resource.AddGoldMine();
            resource.RemoveCurrentPop(4);
            resource.AddNonIdlePop(4);
        }
        else if (build.tag == "Warehouse")
        {
            resource.RemoveWood(warehouseCostWood);
            resource.RemoveGold(warehouseCostWood);
            resource.AddWareHouse();
            resource.RemoveCurrentPop(8);
            resource.AddNonIdlePop(8);

            warehouseCostGold += 100;
            warehouseCostWood += 150;
        }
        else if (build.tag == "Tower")
        {
            resource.RemoveWood(towerCostWood);
            resource.RemoveGold(towerCostGold);
            resource.AddTower();
            resource.RemoveCurrentPop(2);
            resource.AddNonIdlePop(2);
        }
        else if (build.tag == "Church")
        {
            resource.RemoveWood(churchCostWood);
            resource.RemoveGold(churchCostGold);
            resource.AddChurch();
            resource.RemoveCurrentPop(4);
            resource.AddNonIdlePop(4);
            DesactiveOriginalBuilding();
        }
        else if (build.tag == "FireStation")
        {
            resource.RemoveWood(fireStationCostWood);
            resource.RemoveGold(fireStationCostGold);
            resource.AddFireStation();
            resource.RemoveCurrentPop(2);
            resource.AddNonIdlePop(2);
            if (resource.fireStation > 4)
            {
                DesactiveOriginalBuilding();
            }
        }
        else if (build.tag == "Barracks")
        {
            resource.RemoveWood(churchCostWood);
            resource.RemoveGold(churchCostGold);
            resource.AddBarracks();
            resource.RemoveCurrentPop(8);
            resource.AddNonIdlePop(8);
        }
    }