コード例 #1
0
ファイル: WaveSpawner.cs プロジェクト: 18jwong/MITD
    void SpawnEnemy(GameObject eGO)
    {
        // Spawn enemy
        int        randomPoint = (int)Mathf.Round(Random.Range(0, spawnPoints.Length));
        GameObject newEnemyGO  = Instantiate(eGO, spawnPoints[randomPoint].transform.position, Quaternion.identity);

        // Set waveSpawner reference and rowNum for the enemy
        Enemy enemy = newEnemyGO.GetComponent <Enemy>();

        enemy.SetManagerReferences(this);
        enemy.SetRowNum(randomPoint);

        // Add the enemy to 'list of enemies' that towers should shoot at
        towerManager.AddEnemy(newEnemyGO, randomPoint);
    }