public override void OnEnter()
        {
            GameObject gameObject = GameObject.Find(Target.Value);

            if (gameObject != null)
            {
                LocomotionHelper.SetCurrentController <RunController>(gameObject);
            }
            Finish();
        }
 public void OnTriggerExit(Collider col)
 {
     if (col != null && col.CompareTag(Tag) && col.gameObject != null && !LocomotionHelper.IsCurrentControllerOfType <RaceController>(col.gameObject) && Action == ActionType.StartingLine)
     {
         RaceController component = col.gameObject.GetComponent <RaceController>();
         if (component != null)
         {
             component.setControlsEnabled(enabled: true);
         }
     }
 }
예제 #3
0
        private void Update()
        {
            switch (curState)
            {
            case State.Resurfacing:
            case State.QuickResurfacing:
            case State.PostResurfacing:
                updateResurfacing();
                break;

            case State.ExitingWater:
                animator.SetTrigger(AnimationHashes.Params.SwimToWalk);
                base.transform.rotation = Quaternion.LookRotation(new Vector3(base.transform.forward.x, 0f, base.transform.forward.z), Vector3.up);
                LocomotionHelper.SetCurrentController <RunController>(base.gameObject);
                break;

            case State.Interacting:
                if (SceneRefs.ActionSequencer.GetTrigger(base.gameObject) == null)
                {
                    curState = State.None;
                    swim.ResetState();
                }
                break;

            case State.ReactingToHit:
                if (!LocomotionUtils.IsReactingToHit(LocomotionUtils.GetAnimatorStateInfo(animator)))
                {
                    curState = State.None;
                    swim.ResetState();
                }
                break;

            default:
                if (LocomotionUtils.IsReactingToHit(LocomotionUtils.GetAnimatorStateInfo(animator)))
                {
                    curState = State.ReactingToHit;
                }
                if (isWaterTooShallow(mutableData.MaxShallowWaterDepth))
                {
                    curState = State.ExitingWater;
                }
                updateFX();
                break;
            }
            if (TriggerResurface)
            {
                onTriggerResurface();
            }
            if (TriggerQuickResurface)
            {
                pauseHealth();
                TriggerQuickResurface = false;
            }
        }
예제 #4
0
 private IEnumerator ticSwitch()
 {
     for (timerCoroutineIsRunning = true; elapsedTime < PersistForTime; elapsedTime += Time.deltaTime)
     {
         yield return(null);
     }
     if (!PersistWhenSitting || !LocomotionHelper.IsCurrentControllerOfType <SitController>(propUser.gameObject))
     {
         Change(onoff: false);
     }
     timerCoroutineIsRunning = false;
 }
예제 #5
0
 private void OnApplicationPause(bool pauseStatus)
 {
     if (pauseStatus && LocomotionHelper.IsCurrentControllerOfType <RaceController>(base.gameObject))
     {
         CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
         if (cPDataEntityCollection.TryGetComponent <PausedStateData>(cPDataEntityCollection.LocalPlayerHandle, out var component))
         {
             OutOfBoundsWarper component2 = GetComponent <OutOfBoundsWarper>();
             component.Position = component2.StartingPosition;
         }
     }
 }
예제 #6
0
 private void onPropUserEnteredIdle()
 {
     if (base.OnOff && consuming)
     {
         propUser.EPropUserEnteredIdle -= onPropUserEnteredIdle;
         propUser.EPropStored          -= onPropStored;
         consuming = false;
         if ((!PersistWhenSitting || !LocomotionHelper.IsCurrentControllerOfType <SitController>(propUser.gameObject)) && !timerCoroutineIsRunning)
         {
             Change(onoff: 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");
         }
     }
 }