/// <summary> /// Has a single enemy take their turn /// </summary> private void SingleEnemyTurn() { // Increment the index, initial index is -1 ++_curEnIndex; // If all enemies have not taken their turn yet if (_curEnIndex < _allEnemies.Count) { // Pan over to the enemy before we take their turn OnPreSingleEnemyTurn?.Invoke(_allEnemies[_curEnIndex].transform); } // If all the enemies have taken their turn else { // Call the end enemy turn event OnEndEnemyTurn?.Invoke(); } }
public IEnumerator MoveEnemies(Transform target) { yield return(new WaitForSeconds(_turnDelay)); for (int i = 0; i < Enemies.Count; i++) { Enemy enemy = Enemies[i]; enemy.Move(target.position); while (enemy.IsMoving) { yield return(null); } } yield return(new WaitForSeconds(_turnDelay)); OnEndEnemyTurn?.Invoke(this, null); }