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);
    }
Exemple #2
0
 public virtual void OnTeamSwitch(int index, TeamSwitch entity)
 {
 }
Exemple #3
0
 public override void OnTeamSwitch(int index, TeamSwitch entity)
 {
     playerTeamMap[entity.PlayerId] = entity.CurrentTeam;
 }