コード例 #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();
            }
        }
    }