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");
        }
Exemplo n.º 2
0
 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");
         }
     }
 }