private void ConstructBuilding(PreviewBuilding cBuilding)
        {
            GameObject building         = cBuilding.Building;
            Vector3    buildingPosition = building.transform.position;

            TileSystem tileSystem = TileSystem.Instance;

            // don't make construction unsuccessful because building on the same entiy
            if (tileSystem.GetTile(buildingPosition) != null && tileSystem.DoTileContainsEntityOfID(buildingPosition, EntityID))
            {
                // destroy, but don't interupt construction
                cBuilding.Destroy();
                return;
            }

            const TileFlag condition           = TileFlag.Free | TileFlag.Visible;
            bool           tileSetSuccessfully = tileSystem.TrySetTile(building, EntityData.TileSize, condition, EntityID);

            if (tileSetSuccessfully)
            {
                cBuilding.SetConstructionAsFinish(Team.Player);
                _constructionAchievedBuilding.Add(cBuilding);
            }
        }
Exemplo n.º 2
0
 protected override void DestroyAllConstructionBuildings()
 {
     _constructionBuilding.Destroy();
 }