public void OnEnemyTurnEnd() { handledEnemyIndex++; if (handledEnemyIndex >= enemyBehaviours.Count) { handledEnemyIndex = enemyBehaviours.Count; } if (handledEnemyIndex == enemyBehaviours.Count) { if (state == GameState.ENEMY_ATTACK) { handledEnemyIndex = 0; state = GameState.ENEMY_MOVE; playerBehaviour.OnEnemyMove(); } else { handledEnemyIndex = 0; OnEnemiesTurnEnd(); return; } } if (state == GameState.ENEMY_ATTACK) { DoEnemyAttack(); } else { DoEnemyMove(); } }
private void DoEnemyMove() { CustomMonoBehaviour enemy = enemyBehaviours[handledEnemyIndex]; if (enemy.enabled) { enemy.OnEnemyMove(); return; } // If not enabled we just end the turn OnEnemyTurnEnd(); }