예제 #1
0
 /// <summary> undo's the winnings, if the team had one a game
 /// </summary>
 private void undoCompletion()
 {
     if (State == MatchState.VictorFound)
     {
         if (Winner == RedTeam)
         {
             RedTeam.undoWin();
             BlueTeam.undoLoss();
         }
         else
         {
             BlueTeam.undoWin();
             RedTeam.undoLoss();
         }
         Winner = null;
     }
 }
예제 #2
0
        /// <summary>
        /// Resests the match, reverting any actions taken during the match back to the begining state.
        /// </summary>
        public void resetMatch()
        {
            //sets flag that signal system that object has been modified recently
            recentlyModified = true;

            switch (State)
            {
            case MatchState.ByeRound:
                //Get the winner by default, does not affect their win/loss record
                Winner = (RedTeam == null) ? BlueTeam : RedTeam;
                State  = MatchState.ByeRound;
                break;

            case MatchState.VictorFound:
                //First we must fix the team's records
                if (Winner == RedTeam)
                {
                    RedTeam.undoWin();
                    BlueTeam.undoLoss();
                }
                else
                {
                    BlueTeam.undoWin();
                    RedTeam.undoLoss();
                }
                //Clear the winner
                Winner = null;
                //set the state back to no victor found
                State = MatchState.NoVictor;
                break;

            case MatchState.NoVictor:
            case MatchState.Empty:
                break;
            }
            redrawComponents();
        }