CameraOnDriver() public method

public CameraOnDriver ( short carNumber, short group, short camera ) : void
carNumber short
group short
camera short
return void
Exemplo n.º 1
0
        void UpdateBattleCamera(DataSample data)
        {
            if (data.Telemetry.SessionTimeSpan <= cameraChangeTime)
            {
                return;
            }

            cameraChangeTime = data.Telemetry.SessionTimeSpan + this.battleCameraChangePeriod;

            var otherCar = ChangeCarForCamera(data, battleFollower);

            var cameraSet = otherCar == null ? new [] { CameraAngle.LookingInfrontOfCar, CameraAngle.LookingAtCar } : new [] { CameraAngle.LookingInfrontOfCar, CameraAngle.LookingBehindCar, CameraAngle.LookingAtCar };

            camera         = cameraControl.FindACamera(cameraSet, adjustedCamera, 2);
            adjustedCamera = null;

            if (camera.CameraAngle == CameraAngle.LookingBehindCar)
            {
                TraceInfo.WriteLine("{0} Changing to forward car, with reverse camera", data.Telemetry.SessionTimeSpan);
                car = otherCar;
            }
            else
            {
                car = battleFollower;
            }
            TraceInfo.WriteLine("{0} Changing camera to driver: {1}; camera: {2}", data.Telemetry.SessionTimeSpan, car.UserName, camera.CameraName);
            cameraControl.CameraOnDriver(car.CarNumberRaw, camera.CameraNumber);
        }
Exemplo n.º 2
0
        void SwitchToLeader(DataSample data)
        {
            if (reselectLeaderAt < DateTime.Now)
            {
                int posLeaderOnTrack = 1;
                var leader           = data.Telemetry.Cars.First(c => c.Position == posLeaderOnTrack);

                //InterestState curState = editMarker.getInterestState();
                if (editMarker.getInterestState() == InterestState.FirstLap)
                {
                    ////if in first lap make sure that first car on track is selected as leader
                    while (leader.IsInPits)
                    {
                        posLeaderOnTrack += 1;
                        leader            = data.Telemetry.Cars[posLeaderOnTrack];
                        //leader = data.Telemetry.Cars.First(c => c.Position == posLeaderOnTrack);
                    }
                    ;
                }


                cameraControl.CameraOnDriver(leader.Details.CarNumberRaw, cameraControl.RaceStartCameraNumber);

                reselectLeaderAt = DateTime.Now + 1.5.Seconds();
            }
        }
Exemplo n.º 3
0
        public void Direct(DataSample data)
        {
            if (isWatchingRandomDriver)
            {
                return;
            }

            isWatchingRandomDriver = true;

            finishWatchingRandomDriverAt = data.Telemetry.SessionTimeSpan + stickyTime;

            camera = cameraControl.FindACamera(new[] { CameraAngle.LookingInfrontOfCar, CameraAngle.LookingAtCar, CameraAngle.LookingAtTrack });
            car    = FindADriver(data);

            TraceInfo.WriteLine("{0} Changing camera to random driver: {1}; camera: {2}", data.Telemetry.SessionTimeSpan, car.UserName, camera.CameraName);
            cameraControl.CameraOnDriver((short)car.CarNumberRaw, camera.CameraNumber);
        }
Exemplo n.º 4
0
        void SwitchToIncident(DataSample data)
        {
            pitBoxStartTime = 0;

            var incidentCar = nextIncident.Current.Car;

            TraceInfo.WriteLine("{0} Showing incident with {1} starting from {2}", data.Telemetry.SessionTimeSpan, incidentCar.UserName, nextIncident.Current.StartSessionTime);

            cameraControl.CameraOnDriver(incidentCar.CarNumberRaw, cameraControl.IncidentCameraNumber);
        }
Exemplo n.º 5
0
        void SwitchToLeader(DataSample data)
        {
            if (reselectLeaderAt < DateTime.Now)
            {
                var leader = data.Telemetry.Cars.First(c => c.Position == 1);
                cameraControl.CameraOnDriver(leader.Details.CarNumberRaw, cameraControl.RaceStartCameraNumber);

                reselectLeaderAt = DateTime.Now + 1.5.Seconds();
            }
        }
Exemplo n.º 6
0
        void SwitchToFinishingDrivers(DataSample data)
        {
            var session = data.SessionData.SessionInfo.Sessions[data.Telemetry.SessionNum];

            if (lastFinisherCarIdx != -1 && !data.Telemetry.Cars[lastFinisherCarIdx].HasSeenCheckeredFlag)
            {
                timeOfFinisher = DateTime.Now.AddSeconds(2.0 * Settings.AppliedTimingFactor);
                return;
            }

            if (timeOfFinisher > DateTime.Now)
            {
                return;
            }

            Car nextFinisher;

            if (!data.Telemetry.LeaderHasFinished)
            {
                nextFinisher = data.Telemetry.Cars
                               .OrderBy(c => c.Position)
                               .Where(c => c.Details.Driver != null)
                               .Where(c => c.HasData)
                               .First();
            }
            else
            {
                nextFinisher = data.Telemetry.Cars
                               .Where(c => c.TotalDistance > 0)
                               .Where(c => !c.HasSeenCheckeredFlag)
                               .Where(c => !c.Details.IsPaceCar)
                               .Where(c => c.HasData)
                               .Where(c => c.Details.Driver != null)
                               .Where(c => c.TrackSurface == TrackLocation.OnTrack)
                               .OrderByDescending(c => c.DistancePercentage)
                               .ThenBy(c => c.OfficialPostion == 0 ? int.MaxValue : c.OfficialPostion)
                               .FirstOrDefault();
            }

            if (nextFinisher == null)
            {
                Trace.WriteLine("{0} Found no more finishers.".F(data.Telemetry.SessionTimeSpan), "DEBUG");
                return;
            }

            Trace.WriteLine("{0} Found {1} in position {2}".F(data.Telemetry.SessionTimeSpan, nextFinisher.Details.UserName, nextFinisher.Position), "DEBUG");

            timeOfFinisher     = DateTime.Now;
            lastFinisherCarIdx = nextFinisher.CarIdx;

            TraceInfo.WriteLine("{0} Switching camera to {1} as they cross finishing line in position {2}", data.Telemetry.SessionTimeSpan, nextFinisher.Details.UserName, nextFinisher.Position);

            cameraControl.CameraOnDriver(nextFinisher.Details.CarNumberRaw, cameraControl.LastLapCameraNumber);
        }