Ejemplo n.º 1
0
        private void HandlePodRacerHitCheckpoint(PodRacer podRacer, CheckPoint checkPoint)
        {
            PodRacerRaceState podRacerRaceState = raceState.PodRacerRaceStates[podRacer];
            Team          team          = podRacer.Owner;
            TeamRaceState teamRaceState = raceState.TeamRaceStates[team];
            CheckPoint    nextCheckPoint;

            if (podRacerRaceState.CurrentCheckPoint == checkPoint)
            {
                podRacerRaceState.CheckPointsReached++;

                teamRaceState.Timeout = raceRules.TIMEOUT + 1;

                if (checkPoint == arena.GetStartFinish())
                {
                    podRacerRaceState.RoundsFinished++;

                    if (raceResult.WinningTeam == null)
                    {
                        if (podRacerRaceState.RoundsFinished == raceRules.RACE_LENGTH)
                        {
                            raceResult.WinningTeam     = team;
                            raceState.Finished         = true;
                            teamRaceState.FinishedRace = true;
                        }
                    }
                }

                nextCheckPoint = arena.GetNextCheckPoint(checkPoint);
                podRacerRaceState.CurrentCheckPoint = nextCheckPoint;
            }
        }
Ejemplo n.º 2
0
 private void FinalizeRoundForPlayer(Team player, TeamRaceState teamRaceState)
 {
     if (teamRaceState.Timeout > 0)
     {
         teamRaceState.Timeout--;
     }
     else
     {
         throw new ArgumentOutOfRangeException("Player Timeout!");
     }
 }
Ejemplo n.º 3
0
        public TeamRaceState Copy()
        {
            TeamRaceState copy;

            copy = new TeamRaceState();

            copy.Timeout      = Timeout;
            copy.FinishedRace = FinishedRace;
            copy.Disqualified = Disqualified;

            return(copy);
        }