Ejemplo n.º 1
0
        private void OnAsteroidDestroyed(BaseEnemyController enemy)
        {
            var asteroid = _asteroids[enemy.ID];

            asteroid.OnEnemyKilled -= OnAsteroidDestroyed;
            if (asteroid.IsActive)
            {
                _pool.ReturnKilledToPool(asteroid);
            }

            _pointModel.AddPoints(_pointPerEnemy);

            _coroutines[enemy.ID].Dispose();
        }
Ejemplo n.º 2
0
 private void ManagePool(BaseEnemyController enemy)
 {
     if (!_asteroids.Contains(enemy))
     {
         _asteroids.Add(enemy);
         var coroutine = ReturnToPool(enemy.ID, _spawnTime).
                         ToObservable().Subscribe();
         _coroutines.Add(coroutine);
         enemy.InjectPlayerTransform(_playerTransform);
     }
     else
     {
         _coroutines[enemy.ID] = ReturnToPool(enemy.ID, _spawnTime).
                                 ToObservable().Subscribe();
     }
 }