Exemplo n.º 1
0
    private void Update()
    {
        if (mxBodyIdent && mxBodyIdent.GetObjectID() != mLoginModule.mRoleID)
        {
            NFHeroSyncBuffer.Keyframe keyframe = mxSyncBuffer.NextKeyframe();
            if (keyframe != null)
            {
                NFAnimaStateType type = (NFrame.NFAnimaStateType)keyframe.status;
                switch (type)
                {
                case NFAnimaStateType.Run:
                case NFAnimaStateType.Idle:
                    if (keyframe.Position != Vector3.zero)
                    {
                        mxHeroMotor.MoveTo(keyframe.Position, MeetGoalCallBack);
                    }
                    break;

                case NFAnimaStateType.Stun:
                    mAnimatStateController.PlayAnimaState(NFAnimaStateType.Stun, 0);
                    break;

                default:
                    break;
                }
            }
        }
    }
Exemplo n.º 2
0
    private void FixedUpdate()
    {
        if (mxBodyIdent && mxBodyIdent.GetObjectID() != mLoginModule.mRoleID)
        {
            NFHeroSyncBuffer.Keyframe keyframe;
            if (mxSyncBuffer.Size() > 1)
            {
                keyframe = mxSyncBuffer.LastKeyframe();
                mxHeroMotor.walkSpeed *= mxSyncBuffer.Size();
                mxHeroMotor.runSpeed  *= mxSyncBuffer.Size();
            }
            else
            {
                keyframe = mxSyncBuffer.NextKeyframe();
                mxHeroMotor.walkSpeed = mKernelModule.QueryPropertyInt(mLoginModule.mRoleID, NFrame.Player.MOVE_SPEED) / 100;
                mxHeroMotor.runSpeed  = mKernelModule.QueryPropertyInt(mLoginModule.mRoleID, NFrame.Player.MOVE_SPEED) / 100;
            }

            if (keyframe != null)
            {
                NFAnimaStateType type = (NFrame.NFAnimaStateType)keyframe.status;
                switch (type)
                {
                case NFAnimaStateType.Run:
                case NFAnimaStateType.Idle:
                    if (keyframe.Position != Vector3.zero)
                    {
                        mxHeroMotor.MoveTo(keyframe.Position, true, MeetGoalCallBack);
                    }
                    break;

                case NFAnimaStateType.Stun:
                    mAnimatStateController.PlayAnimaState(NFAnimaStateType.Stun, 0);
                    break;

                default:
                    break;
                }
            }
        }
    }
Exemplo n.º 3
0
    private void Update()
    {
        if (mxBodyIdent && mxBodyIdent.GetObjectID() != mLoginModule.mRoleID)
        {
            NFHeroSyncBuffer.Keyframe keyframe = mxSyncBuffer.NextKeyframe();
            if (keyframe != null)
            {
                NFAnimaStateType type = (NFrame.NFAnimaStateType)keyframe.status;
                switch (type)
                {
                case NFAnimaStateType.Run:
                case NFAnimaStateType.Idle:
                    mxHeroMotor.MoveTo(keyframe.Position);
                    break;

                default:
                    break;
                }
            }
        }
    }
Exemplo n.º 4
0
    private void FixedUpdate()
    {
        ReportPos();

        if (mxBodyIdent && mxBodyIdent.GetObjectID() != mLoginModule.mRoleID)
        {
            NFHeroSyncBuffer.Keyframe keyframe;
            if (mxSyncBuffer.Size() > 1)
            {
                keyframe = mxSyncBuffer.LastKeyframe();
            }
            else
            {
                keyframe = mxSyncBuffer.NextKeyframe();
            }

            if (keyframe != null)
            {
                mxHeroMotor.walkSpeed = moveSpeed;
                mxHeroMotor.runSpeed  = moveSpeed;

                float dis = Vector3.Distance(keyframe.Position, mxHeroMotor.transform.position);
                if (dis > 1f)
                {
                    mxHeroMotor.walkSpeed = dis / SYNC_TIME;
                    mxHeroMotor.runSpeed  = dis / SYNC_TIME;
                }

                lastInterpolationTime = keyframe.InterpolationTime;


                NFAnimaStateType stateType = (NFrame.NFAnimaStateType)keyframe.status;
                switch (stateType)
                {
                case NFAnimaStateType.Run:
                    if (keyframe.Position != Vector3.zero)
                    {
                        mxHeroMotor.MoveTo(keyframe.Position, true, MeetGoalCallBack);
                    }
                    break;

                case NFAnimaStateType.Idle:
                    if (UnityEngine.Vector3.Distance(keyframe.Position, mxHeroMotor.transform.position) > 0.1f)
                    {
                        mxHeroMotor.MoveTo(keyframe.Position, true, MeetGoalCallBack);
                    }
                    else
                    {
                        mxHeroMotor.Stop();
                    }
                    break;

                case NFAnimaStateType.Stun:
                    mAnimatStateController.PlayAnimaState(NFAnimaStateType.Stun, 0);
                    break;

                case NFAnimaStateType.NONE:
                    mxHeroMotor.transform.position = keyframe.Position;
                    break;

                default:
                    break;
                }
            }
        }
    }