Exemple #1
0
    private EnemyController GetEnemyController(EnemyData enemyData)
    {
        EnemyController enemyController;

        if (_instantiatedEnemies.ContainsKey(enemyData.GetId()))
        {
            enemyController = _instantiatedEnemies[enemyData.GetId()];
            enemyController.gameObject.SetActive(true);
            enemyController.ResetDefaultProperties();
        }
        else
        {
            enemyController = Instantiate(_enemyControllerPrefab, _spawnLocation.position, _spawnLocation.rotation);
            enemyController.SetData(enemyData);

            _instantiatedEnemies.Add(enemyData.GetId(), enemyController);
        }

        return(enemyController);
    }