예제 #1
0
        /// <summary>
        /// Activate the hand pose motion
        /// </summary>
        /// <param name="rHandPose"></param>
        protected void SetHandPose(BasicHandPose rHandPose)
        {
            if (rHandPose == null)
            {
                return;
            }

            //Debug.Log("[BasicHandPoseReactor] Setting " + rHandPose.Name);
            mMotionController.ActivateMotion(rHandPose);
        }
예제 #2
0
        /// <summary>
        /// Deactivate the hand pose motion
        /// </summary>
        /// <param name="rHandPose"></param>
        protected void ReleaseHandPose(BasicHandPose rHandPose)
        {
            if (rHandPose == null || !rHandPose.IsActive)
            {
                return;
            }

            //Debug.Log("[BasicHandPoseReactor] Releasing " + rHandPose.Name);
            rHandPose.Deactivate();
        }
예제 #3
0
        /// <summary>
        /// Called when the reactor is first activated
        /// </summary>
        /// <returns>Determines if other reactors should process.</returns>
        public override bool Activate()
        {
            base.Activate();

            MotionMessage lMessage = (MotionMessage)mMessage;

            // We want to release the hand pose motion when the "Store" motion is activated (otherwise the hand will stay closed
            // until the animation has completed)
            if (lMessage.ID == EnumMessageID.MSG_MOTION_ACTIVATE)
            {
                if (lMessage.Motion is IStoreMotion)
                {
                    if (mRightHandPose == null)
                    {
                        mRightHandPose = mMotionController.GetMotion(EnumMotionLayer.RIGHT_HAND, RightHandPoseName) as BasicHandPose;
                    }
                    if (mLeftHandPose == null)
                    {
                        mLeftHandPose = mMotionController.GetMotion(EnumMotionLayer.LEFT_HAND, LeftHandPoseName) as BasicHandPose;
                    }

                    ReleaseHandPose(mRightHandPose);
                    ReleaseHandPose(mLeftHandPose);
                }
            }
            // We want to set the hand pose motion when the "Equip" motion deactivates (after the animation is finished) so that
            // the hand doesn't close too early
            else if (lMessage.ID == EnumMessageID.MSG_MOTION_DEACTIVATE)
            {
                if (lMessage.Motion is IEquipMotion)
                {
                    if (mRightHandPose == null)
                    {
                        mRightHandPose = mMotionController.GetMotion(EnumMotionLayer.RIGHT_HAND, RightHandPoseName) as BasicHandPose;
                    }
                    if (mLeftHandPose == null)
                    {
                        mLeftHandPose = mMotionController.GetMotion(EnumMotionLayer.LEFT_HAND, LeftHandPoseName) as BasicHandPose;
                    }

                    // TODO: check for two-handed weapon, as we don't want the left hand to stay closed ... or the LH pose state may simply be Empty
                    // May need to use a ReleaseOffHandPose tag for motions like Jump where one hand will come off the weapon.
                    SetHandPose(mRightHandPose);
                    SetHandPose(mLeftHandPose);
                }
            }


            // Disable the reactor
            Deactivate();

            // Allow other reactors to continue
            return(true);
        }