public DriverOfftrackLimit AddLimit(DriverContainer driver, int count) { if (this.DriverLimits.Any( d => d.Driver.Driver.Id == driver.Driver.Id && d.OfftrackCount == count)) { // Already added return null; } var limit = new DriverOfftrackLimit(driver, count); this.DriverLimits.Add(limit); return limit; }
public void AddOfftrackPenalty(DriverOfftrackLimit limit) { Penalty penalty; penalty = Penalty.Create(); penalty.Reason = "Ignoring track limits"; penalty.Camera = CameraControl.GetCurrentCameraSessionTime(); penalty.Lap = limit.Driver.Driver.Live.Lap.ToString(); SyncManager.Instance.State.Penalties.Add(penalty); // Create incident event var @event = new ReplayEvent(); @event.Type = ReplayEvent.EventTypes.Incident; @event.AdminId = SyncManager.Instance.UserId; @event.Camera = penalty.Camera; // _mainModel.ReplayBarModel.AddEvent(@event); penalty.StartInvestigation(limit.Driver.Driver.Id, SyncManager.Instance.User); SyncManager.Instance.SendStateUpdate(SyncCommandHelper.AddPenalty(penalty)); }
//public void ClearOfftracks() //{ // SyncManager.Instance.SendStateUpdate(SyncCommandHelper.ClearOfftracks()); // foreach (var driver in Simulator.Instance.Drivers.ToList()) // { // driver.Driver.OfftrackHistory.Clear(); // } // this.UpdateLines(); //} public void NotifyOfftrackLimit(DriverOfftrackLimit limit) { _mainModel.NotifyOfftrackLimit(limit); }