예제 #1
0
파일: TurnSystem.cs 프로젝트: nwarcord/Wisp
    // ----------------------------------------------------------------
    // Turn handling
    // ----------------------------------------------------------------

    public void NextTurn()
    {
        if (actors.Count <= 1)
        {
            EndCombat();
        }
        if (combatRunning)
        {
            if (currentTurn >= actors.Count)
            {
                currentTurn = 0;
                actors.RemoveAll(item => CustomHelpers.IsNullOrDestroyed(item)); // GC for null objects
            }

            // Debug.Log("Actor Turn: " + actors[currentTurn] + " at turn num: " + currentTurn + " with total actors: " + actors.Count);

            if (!CustomHelpers.IsNullOrDestroyed(actors[currentTurn]))
            {
                actors[currentTurn].TakeTurn();
                currentTurn++;
            }
            else
            {
                currentTurn++;
                EventManager.RaiseActorTurnOver();
            }
        }
    }