Esempio n. 1
0
 public void LoadTeamTurnMap(int teamIndex, Team team)
 {
     //team members start off with their turns organized in-order
     //with the exception being the leader
     loadTeamMemberTurnMap(teamIndex, team, team.GetLeaderIndex());
     for (int ii = 0; ii < team.Players.Count; ii++)
     {
         if (ii != team.GetLeaderIndex())
         {
             loadTeamMemberTurnMap(teamIndex, team, ii);
         }
     }
 }
Esempio n. 2
0
        public void RemoveChar(CharIndex charIndex)
        {
            CharIndex turnChar = ZoneManager.Instance.CurrentMap.CurrentTurnMap.GetCurrentTurnChar();

            //note: this cannot be called when it is the character's turn
            if (turnChar == charIndex)
            {
                throw new Exception("Attempted to delete a character on their turn.");
            }

            Team team = null;

            if (charIndex.Team == -1)
            {
                team = ZoneManager.Instance.CurrentMap.ActiveTeam;
            }
            else
            {
                team = ZoneManager.Instance.CurrentMap.MapTeams[charIndex.Team];
            }

            Character character = team.Players[charIndex.Char];

            character.OnRemove();
            team.Players.RemoveAt(charIndex.Char);

            //update leader
            if (team is ExplorerTeam && charIndex.Char < team.GetLeaderIndex())
            {
                ((ExplorerTeam)team).LeaderIndex--;
            }

            ZoneManager.Instance.CurrentMap.CurrentTurnMap.UpdateCharRemoval(charIndex.Team, charIndex.Char);

            if (charIndex.Team == -1 && focusedPlayerIndex > charIndex.Char)
            {
                focusedPlayerIndex--;
            }

            //if the team is all empty (not all dead), definitely remove them
            if (team.Players.Count == 0 && charIndex.Team > -1)
            {
                RemoveTeam(charIndex.Team);
            }
        }