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

            if (gameObject != null)
            {
                LocomotionHelper.SetCurrentController <RunController>(gameObject);
            }
            Finish();
        }
Example #2
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;
            }
        }
 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");
         }
     }
 }