コード例 #1
0
    void SpawnGroundTiles()
    {
        Vector3 tilePlacementPosition = Vector3.zero;

        for (int i = 0; i < Settings.GetWorldSize().x; i++)
        {
            for (int j = 0; j < Settings.GetWorldSize().y; j++)
            {
                tilePlacementPosition.x = Settings.GetTileSize() * i;
                tilePlacementPosition.z = Settings.GetTileSize() * j;

                var tile = PoolBoss.GetUnusedObject <Tile.GroundTile>();

                tile.GetComponent <Tile>().Init();
                tile.name = "Ground Tile #" + ((i * Settings.GetWorldSize().x) + j);
                SetPositionAndRotation(tile, tilePlacementPosition, Quaternion.identity);
            }
        }
    }