コード例 #1
0
ファイル: EnemySpawner.cs プロジェクト: OpriaIonut/RPG-game
    public void SpawnEnemy(int index)
    {
        int enemyIndex         = Random.Range(0, spawnPoints[index].possibleEnemiesPrefab.Length);
        MapEnemyMovement clone = Instantiate(spawnPoints[index].possibleEnemiesPrefab[enemyIndex], spawnPoints[index].transform).GetComponent <MapEnemyMovement>();

        EnemyEncounterHolder enemyEncounterScript = clone.GetComponent <EnemyEncounterHolder>();

        clone.enemyIndex = index;

        enemyEncounterScript.GenerateEnemies(spawnPoints[index]);
        pauseMenu.AddEnemyMovementScript(ref clone);
    }
コード例 #2
0
 //Called by the EnemySpawner (some enemies will be spawned with a delay and it is called at the moment they are spawned so that we can stop their movement too) (hopefuly the enemies are not spawned when the game is paused)
 public void AddEnemyMovementScript(ref MapEnemyMovement script)
 {
     enemyMovementScripts.Add(script);
 }