private void jumpToRestartLocation() { GameObject localPlayerGameObject = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject; Vector3 raceRestartPosition = tubeRaceDefinition.RaceRestartPosition; RaceController component = localPlayerGameObject.GetComponent <RaceController>(); if (component != null) { component.setControlsEnabled(enabled: true); } LocomotionTracker component2 = localPlayerGameObject.GetComponent <LocomotionTracker>(); if (!component2.IsCurrentControllerOfType <RunController>()) { component2.SetCurrentController <RunController>(); } localPlayerGameObject.transform.position = raceRestartPosition; RaceGameController component3 = localPlayerGameObject.GetComponent <RaceGameController>(); if (component3 != null) { component3.RemoveLocalPlayerRaceData(); Object.Destroy(component3); } Service.Get <EventDispatcher>().DispatchEvent(new CinematographyEvents.CameraSnapLockEvent(snapPosition: false, snapAim: true)); CoroutineRunner.Start(LocomotionUtils.nudgePlayer(component2), component2.gameObject, "MoveAfterJump"); }
private void Awake() { playerCharacterController = FindObjectOfType <PlayerCharacterController>(); playerCharacter = FindObjectOfType <PlayerCharacter>(); raceGameController = FindObjectOfType <RaceGameController>(); flappyController = FindObjectOfType <GameController>(); scoreBoardController = FindObjectOfType <ScoreBoardController>(); fishFightGameController = FindObjectOfType <FishFightGameController>(); avoidObstaclesGameController = FindObjectOfType <avoidObstaclesGameController>(); ClearParametr(); }
public void InitializeRace(RaceGameController raceGameController) { this.raceGameController = raceGameController; fixedSpeed = 0f; interpolatedFixedSpeed = fixedSpeed; maxSpeed = myMutableData.RaceTrackProperties.MaxSpeed; interpolatedMaxSpeed = maxSpeed; firstTrackDir = false; chaseCamera = null; raceControllerMode = RaceControllerMode.Countdown; delayUI = 2; }
private bool onOutOfBoundsReset(OutOfBoundsWarperEvents.ResetPlayer evt) { if (base.gameObject.activeSelf && chaseCamera != null) { chaseCamera.Disable(); setControlsEnabled(enabled: true); RaceGameController component = evt.Player.GetComponent <RaceGameController>(); if (component != null) { component.RemoveLocalPlayerRaceData(); Object.Destroy(component); } } return(false); }
public void OnTriggerEnter(Collider col) { if (!(col != null) || !col.CompareTag(Tag) || !(col.gameObject != null) || (IsMemberOnly && !Service.Get <CPDataEntityCollection>().IsLocalPlayerMember())) { return; } if (Action == ActionType.StartingLine) { RaceController component = col.gameObject.GetComponent <RaceController>(); if ((object)component != null) { component.SetInitialTrackDir(base.transform.forward); hasPopupOpened = false; } } else if (Action == ActionType.FinishLine) { if (LocomotionHelper.IsCurrentControllerOfType <RaceController>(col.gameObject)) { RaceGameController raceGameController = col.gameObject.GetComponent <RaceGameController>(); if (raceGameController == null) { raceGameController = col.gameObject.AddComponent <RaceGameController>(); } raceGameController.FinishRace(); } } else if (Action == ActionType.EndOfTrack && LocomotionHelper.IsCurrentControllerOfType <RaceController>(col.gameObject)) { RaceController component = col.gameObject.GetComponent <RaceController>(); if (component != null) { component.setControlsEnabled(enabled: true); } LocomotionHelper.SetCurrentController <RunController>(col.gameObject); RaceGameController raceGameController = col.gameObject.GetComponent <RaceGameController>(); if (raceGameController != null) { raceGameController.RemoveLocalPlayerRaceData(); Object.Destroy(raceGameController); } if (!hasPopupOpened) { Service.Get <QuestService>().SendEvent("FinishredRace"); } } }
protected override void Update() { GameObject target = GetTarget(); if (target == SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject && !LocomotionHelper.IsCurrentControllerOfType <RaceController>(target)) { LocomotionHelper.SetCurrentController <RaceController>(target); LocomotionController currentController = LocomotionHelper.GetCurrentController(target); if (currentController is RaceController) { RaceGameController raceGameController = target.GetComponent <RaceGameController>(); if (raceGameController == null) { raceGameController = target.AddComponent <RaceGameController>(); } ((RaceController)currentController).InitializeRace(raceGameController); raceGameController.InitializeRace(RaceGate, Lite1a, Lite2a, Lite3a, Lite1b, Lite2b, Lite3b, SilverTimeMS, GoldTimeMS, LegendaryTimeMS, TrackId); } } Completed(); }