예제 #1
0
 public void ClearDelegates()
 {
     PlayerHealthUpdateCall = null;
     EnemyHealthUpdateCall  = null;
     CombatEndVictoryCall   = null;
     CombatEndDefeatCall    = null;
 }
    public bool RunAway()
    {
        if (CombatEnd != null)
        {
            CombatEnd.Invoke();
        }


        Debug.Log("Combat Finished.");

        return(true);
    }
    public bool NextTurn()
    {
        //if the team attacked is all dead
        if (IsAllTeamDead(((!currentTeamsTurn_) ? team2_ : team1_)))
        {
            if (CombatEnd != null)
            {
                CombatEnd.Invoke();
            }


            Debug.Log("Combat Finished.");

            return(true);
        }

        currentCharactersTurn_.CharacterTurnEnds();

        switch (settings_.attackOrder_)
        {
        case CombatSystemSettings.AttackOrder.AlternateTeamEveryTeamTurn:

            if (IsLastAliveInTeamToTakeTurn(((currentTeamsTurn_) ? team2_ : team1_), currentCharactersTurn_))
            {
                currentTeamsTurn_      = !currentTeamsTurn_;
                currentCharactersTurn_ = GetFirstCharacterToTakeTurnInTeam(((currentTeamsTurn_) ? team2_ : team1_));

                if (TeamSwitch != null)
                {
                    TeamSwitch.Invoke();
                }
            }
            else
            {
                currentCharactersTurn_ = GetNextAliveCharacterInTeam(((currentTeamsTurn_) ? team2_ : team1_), currentCharactersTurn_);
            }

            break;
        }

        if (AttackFinished != null)
        {
            AttackFinished.Invoke();
        }

        currentCharactersTurn_.CharacterTurnStarts();

        return(true);
    }