예제 #1
0
        /// <summary>
        /// Tests if the motion should continue. If it shouldn't, the motion
        /// is typically disabled
        /// </summary>
        /// <returns></returns>
        public override bool TestUpdate()
        {
            if (mIsActivatedFrame)
            {
                return(true);
            }
            if (mActorController.State.Stance != EnumControllerStance.SWIMMING)
            {
                return(false);
            }

            // Ensure we're in the animation
            if (mIsAnimatorActive && !IsInMotionState)
            {
                return(false);
            }

            // Ensure we're in water
            if (mSwimmerInfo == null || mSwimmerInfo.WaterSurface == null)
            {
                return(false);
            }

            // If we're in the idle state with no movement, stop
            if (mMotionLayer._AnimatorStateID == STATE_TreadIdlePose)
            {
                if (mMotionController.State.InputMagnitudeTrend.Value < 0.1f)
                {
                    return(false);
                }
            }
            // If we're surfacing, exit to the idle pose
            else if (mMotionLayer._AnimatorStateID == STATE_IdlePose)
            {
                mSwimmerInfo.ExitWater();
                return(false);
            }

            // Just incse, ensure we're in water
            float lWaterMovement = mSwimmerInfo.WaterSurface.position.y - mSwimmerInfo.WaterSurfaceLastPosition.y;
            float lDepth         = mSwimmerInfo.GetDepth();

            if (lDepth - lWaterMovement <= 0f)
            {
                mSwimmerInfo.ExitWater();
                return(false);
            }

            // Stay in
            return(true);
        }
예제 #2
0
        /// <summary>
        /// Tests if the motion should continue. If it shouldn't, the motion
        /// is typically disabled
        /// </summary>
        /// <returns>Boolean that determines if the motion continues</returns>
        public override bool TestUpdate()
        {
            // Ensure we're in the animation
            if (mIsAnimatorActive)
            {
                // Ensure we're in a valid animation
                if (!IsInMotionState)
                {
                    return(false);
                }
            }

            // If we're surfacing, exit to the idle pose
            if (mMotionLayer._AnimatorStateID == STATE_IdlePose || mMotionLayer._AnimatorStateID == STATE_TreadIdleExitPose)
            {
                mSwimmerInfo.ExitWater();
                return(false);
            }

            return(true);
        }