Esempio n. 1
0
                    public float RaceTimeBehindNext()
                    {
                        _Racer RacerNext = GetPosionNext();

                        if (RacerNext == this)
                        {
                            return(0);
                        }
                        if (RacerNext == null)
                        {
                            return(0);
                        }

                        int RacerThisSectorCount = CumulativeSectorTimeStamps.Count();

                        if (RacerThisSectorCount > RacerNext.CumulativeSectorTimeStamps.Count())
                        {
                            return(0);
                        }
                        float RacerNextTimestamp = RacerNext.CumulativeSectorTimeStamps[RacerThisSectorCount - 1];
                        float RacerThisTimestamp = CumulativeSectorTimeStamps[RacerThisSectorCount - 1];
                        float TimeBehind         = RacerThisTimestamp - RacerNextTimestamp;

                        return(TimeBehind);
                    }
Esempio n. 2
0
                    public float RaceTimeGetTotalTime()
                    {
                        //timestamp race started
                        //latest cumulative time
                        //end time.
                        if (CurrentCheckpoint / Race.Path.Points.Count() >= Race.TotalLapCount)
                        {
                            //already finished the race, get the race time!
                            return(CumulativeSectorTimeStamps.Last());
                        }
                        else
                        {
                            //not finished the race, get the current vehicle timestamp...
                            if (Client.Vehicle != Vehicles.NoVehicle)
                            {
                                return(Client.Vehicle.TimeStamp - TimeStamp_RaceStarted);
                            }

                            //no vehicle, use a rough estimate.
                            else
                            {
                                return((float)(DateTime.Now - Race.RaceStarted).TotalSeconds);
                            }
                        }
                    }
Esempio n. 3
0
                    public float RaceTimeAheadOfPrev()
                    {
                        _Racer RacerPrev = GetPosionPrev();

                        if (RacerPrev == this)
                        {
                            return(0);
                        }
                        if (RacerPrev == null)
                        {
                            return(0);
                        }

                        int RacerPrevSectorCount = RacerPrev.CumulativeSectorTimeStamps.Count();

                        if (CumulativeSectorTimeStamps.Count() < RacerPrevSectorCount)
                        {
                            return(0);
                        }
                        float RacerPrevTimestamp = RacerPrev.CumulativeSectorTimeStamps[RacerPrevSectorCount - 1];
                        float RacerThisTimestamp = CumulativeSectorTimeStamps[RacerPrevSectorCount - 1];
                        float TimeAhead          = RacerThisTimestamp - RacerPrevTimestamp;

                        return(TimeAhead);
                    }