public void SpawnEnemy() { EnemyControllerView enemy = GameObject.Instantiate(enemyPrefab.gameObject, mapManager.GetRandomSpawnPosition(), Quaternion.identity).GetComponent <EnemyControllerView>(); enemy.SetManager(this, mapManager); enemies.Add(enemy); }
public EnemyManager(EnemyControllerView enemyPrefab, MapManager mapManager) { this.mapManager = mapManager; this.enemyPrefab = enemyPrefab; gameManager = GameManager.Instance; gameManager.onGameReset += Reset; }
public void DestroyEnemy(EnemyControllerView enemy) { enemies.Remove(enemy); gameManager.UpdateScore(5); if (enemies.Count == 0) { gameManager.GameOver("You Won"); } }