void OnDestroy() { _screenRec.StopRecording(); DeleteReplayFile(); _screenRec.OnStopRec -= _replayCam_OnStopRec; foreach (VehicleManager rvm in ReplayerVehicleManagers) { rvm.DestroyVehicle(); } Destroy(CCF); iVehicleManager CM = DrivingPlayManager.Current.PlayerCarManager; Destroy(ReplayCamController); if (ReopenDrivingMenuOnDestroy && CM.goCar != null) { DrivingPlayManager.Current.UnfreezeCars(); CamSelector.Instance.ActiveCam.GetComponentInChildren <Camera>().enabled = true; CamController_Follow_Swing CamFol = CamSelector.Instance.ActiveCam.GetComponent <CamController_Follow_Swing>(); CamFol.target = CM.goCar; CamFol.enabled = true; RaceRecorder.current.State = "Recording"; DrivingPlayManager.Current.UnpauseCars(); DrivingMenuController dmc = _canvas.GetComponent <DrivingMenuController>(); if (dmc == null) { Debug.LogError("dmc is null"); Debug.Break(); } dmc.ShowPanel(true); //Keeps crashing here not any more cos fixed line 44 } }
public Racer(iVehicleManager vm, DamageController dc, iRace Race, bool IsMachine) { isMachine = IsMachine; _Race = Race; VehicleManager = vm; _damCtrl = dc; goRacer = vm.goCar; _vehicleController = vm.VehicleController; _defaultMotorForce = _vehicleController.motorForce; _gps = _vehicleController.Gps; if (IsMachine) { _playerGps = DrivingPlayManager.Current.PlayerCarManager.Gps; _playerRacer = DrivingPlayManager.Current.PlayerCarManager.Racer; } else { _scorer = new Scorer(vm, _gps); music = MusicPlayer.Instance; } RoadSegCount = Road.Instance.Segments.Count; if (goRacer.name == "Vehicle1") { _vehicleController.motorForce *= 1.1f; //This car is more powerful. It jumps backward and comes up behind you } _damCtrl.OnCollisionExitEvent += StartHogTimer; }
public Scorer(iVehicleManager vm, GPS gps) { _goVeh = vm.goCar; _gps = gps; _gps.OnDrift += Drift; _gps.OnLand += Land; _gps.OnTakeOff += TakeOff; _gps.OnRecovery += Recovery; _gps.OnDriftEnd += DriftEnd; _gps.OnDriftFail += DriftFail; }
public RecordableVehicle(iVehicleManager vm) { VId = vm.VId; Vehicle = vm.Vehicle; Color = vm.Color; Transform = vm.goCar.transform; InputManager = vm.VehicleController.InputManager; DMC = vm.goCar.GetComponent <DamageController>(); WCFL = Transform.Find("WheelColliders/WCFL").GetComponent <WheelController>(); WCRL = Transform.Find("WheelColliders/WCRL").GetComponent <WheelController>(); WCFR = Transform.Find("WheelColliders/WCFR").GetComponent <WheelController>(); WCRR = Transform.Find("WheelColliders/WCRR").GetComponent <WheelController>(); }
public void RewToStart() { State = "Stopped"; CurrFrame = StartFrame; Recording.CurrFrame = CurrFrame; Road.Instance.RemoveRuts(); RespawnCars(); DrivingPlayManager.Current.FreezeCars(); iVehicleManager CM = PlayerCarManager; DrivingPlayManager.Current.SendPlayerInstantiateEvent(CM.goCar.transform); CCF.Car = CM.goCar.transform; GameObjectController.DrawFrame(Recording.Data[CurrFrame]); CCF.ChooseFollow(); try { pnlBuyCameras.SetActive(true); } catch { } //_replayCam.StopRecording(); }
protected virtual void Dispose(bool b) { RemoveListeners(); _Race = null; VehicleManager = null; goRacer = null; _vehicleController = null; _damCtrl = null; _gps = null; _playerGps = null; _playerRacer = null; _scorer = null; if (PlayerOpposition != null) { PlayerOpposition.Clear(); Opposition.Clear(); } }
public void FreezeCar(iVehicleManager cm) { cm.goCar.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePosition; }