コード例 #1
0
    public void CollectFromAllBuildings()
    {
        float incomeThisTurn = 0;

        foreach (CustomTile pTile in _tileMap)
        {
            Building building = pTile.GetBuildingOnTile();
            if (building != null)
            {
                if (building is ProductionBuilding)
                {
                    ProductionBuilding productionBuilding = building as ProductionBuilding;
                    incomeThisTurn += productionBuilding.Produce();
                }
                if (building is Digsite)
                {
                    Digsite digSite = building as Digsite;
                    digSite.DoAction();
                }
            }
        }
        ReceiveCollection((int)incomeThisTurn);
    }