Ejemplo n.º 1
0
    /// <summary>
    /// Fill tile with given size with data of building type.
    /// </summary>
    public static void SetWorldTileData(Int2 point, int buildingIndex, Size buildingSize, bool overrideControl = false)
    {
        if (!IsWorldTileBuildable(point, buildingSize) && !overrideControl)
        {
            return;
        }

        groundTiles[point.x, point.y].type = TileTypes.BuildingCore;
        PlayerPrefsHelper.SaveTileData(point, TileTypes.BuildingCore, buildingIndex);

        // We need to change this, if we're going to handle more than size 2 buildings
        if (buildingSize.width > 1)
        {
            groundTiles[point.x + 1, point.y].type = TileTypes.BuildingPart;
        }

        if (buildingSize.height > 1)
        {
            groundTiles[point.x, point.y + 1].type     = TileTypes.BuildingPart;
            groundTiles[point.x + 1, point.y + 1].type = TileTypes.BuildingPart;
        }
    }