Ejemplo n.º 1
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;
            }
        }