private void InitRaceState() { RaceState = new RaceState(this); foreach (var team in Teams) { RaceState.TeamRaceStates.Add(team, new TeamRaceState()); foreach (var podRacer in team.PodRacers) { RaceState.PodRacerRaceStates.Add(podRacer, new PodRacerRaceState(podRacer)); } } }
public static RaceState CreateInterpolation(RaceState a, RaceState b, double time) { RaceState interpolation; interpolation = a.Copy(); interpolation.Time = time; List <PodRacer> keys; keys = interpolation.PodRacerRaceStates.Keys.ToList(); foreach (var podRacerRaceStateKeys in keys) { interpolation.PodRacerRaceStates[podRacerRaceStateKeys] = PodRacerRaceState.CreateInterpolation(a.PodRacerRaceStates[podRacerRaceStateKeys], b.PodRacerRaceStates[podRacerRaceStateKeys], (time - a.Time) / (b.Time - a.Time)); } return(interpolation); }
public RaceState Copy() { RaceState copy; copy = new RaceState(this.Race); copy.Round = Round; copy.Time = Time; copy.Finished = Finished; foreach (var vkp in PodRacerRaceStates) { copy.PodRacerRaceStates.Add(vkp.Key, vkp.Value.Copy()); } foreach (var vkp in TeamRaceStates) { copy.TeamRaceStates.Add(vkp.Key, vkp.Value.Copy()); } return(copy); }