Exemplo n.º 1
0
        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));
                }
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }