示例#1
0
    void Start()
    {
        numberOfTimesToSpawnClearOne = 1;
        chunkTileListAux             = chunkTileList;

        lastChunkSpawned = chunkTileListAux.chunkTiles[0];
    }
示例#2
0
    public static EnemyType[,] GetEnemiesInChunk()
    {
        if (numberOfTimesToSpawnClearOne > 0)
        {
            chunkIndex = 0;
            numberOfTimesToSpawnClearOne--;
        }
        else
        {
            chunkIndex = Random.Range(0, chunkTileListAux.chunkTiles.Length);
        }

        var _chunkTile = chunkTileListAux.chunkTiles[chunkIndex];

        EnemyType[,] _enemies = new EnemyType[_chunkTile.chunkTile.Length, _chunkTile.chunkTile[0].enemies.Length];


        if (lastChunkSpawned.prohibitedNextList.Contains(_chunkTile))
        {
            GetEnemiesInChunk();
        }
        else
        {
            for (byte a = 0; a < _enemies.GetLength(0); a++)
            {
                for (byte b = 0; b < _enemies.GetLength(1); b++)
                {
                    _enemies[a, b] = _chunkTile.chunkTile[a].enemies[b];
                    //Debug.Log(_enemies[a,b]);

                    GameObject newEnemy;
                    newEnemy = Instantiate(Resources.Load(_enemies[a, b].ToString()), new Vector3(Block.TileGO[a, b].transform.position.x, Block.TileGO[a, b].transform.position.y + 0.20f, Block.TileGO[a, b].transform.position.z), Quaternion.identity, Block.TileGO[a, b].transform) as GameObject;

                    lastChunkSpawned = _chunkTile;
                }
            }
        }

        return(_enemies);
    }