Exemplo n.º 1
0
    private IEnumerator GenerateWorld_Random()
    {
        int numTypes = System.Enum.GetValues(typeof(WorldTileType)).Length;

        for (int row = 0; row < _numRows; row++)
        {
            for (int col = 0; col < _numCols; col++)
            {
                WorldTileType tileType = (WorldTileType)(Random.Range(0, numTypes));
                if (col == 0 || col == _numCols - 1)
                {
                    tileType = WorldTileType.Pillar;
                }
                if (row == 0 || row == _numRows - 1)
                {
                    tileType = WorldTileType.Pillar;
                }

                WorldTile tile = GetRootTile(col, row);
                tile.SetTileType(tileType);
            }

            yield return(new WaitForEndOfFrame());
        }
    }
Exemplo n.º 2
0
    private WorldTile CreateTile(int col, int row, WorldTileType tileType)
    {
        WorldTile tile = new WorldTile(col, row);

        tile.SetTileType(tileType);

        return(tile);
    }