Esempio n. 1
0
    void ReportPos()
    {
        if (lastReportTime <= 0f)
        {
            mNetModule.RequireMove(mLoginModule.mRoleID, (int)NFAnimaStateType.NONE, mxHeroMotor.transform.position);
        }

        if (Time.time > (SYNC_TIME + lastReportTime))
        {
            lastReportTime = Time.time;

            if (mLoginModule.mRoleID == mxBodyIdent.GetObjectID())
            {
                if (lastPos != mxHeroMotor.transform.position)
                {
                    if (mxHeroMotor.moveToPos != Vector3.zero)
                    {
                        //是玩家自己移动
                        lastPos     = mxHeroMotor.moveToPos;
                        canFixFrame = false;
                    }
                    else
                    {
                        //是其他技能导致的唯一,比如屠夫的钩子那种
                        lastPos     = mxHeroMotor.transform.position;
                        canFixFrame = false;
                    }

                    mNetModule.RequireMove(mLoginModule.mRoleID, (int)mAnimaStateMachine.CurState(), lastPos);
                }
                else
                {
                    //fix last pos
                    if (canFixFrame)
                    {
                        canFixFrame = false;
                        mNetModule.RequireMove(mLoginModule.mRoleID, (int)mAnimaStateMachine.CurState(), lastPos);
                    }
                }
            }
        }
    }
Esempio n. 2
0
    void Sync()
    {
        mSyncTimeTick += Time.deltaTime;

        if (mbMoved && grounded && mSyncTimeTick > mSyncTime)
        {
            mNetModule.RequireMove(mLoginModule.mRoleID, 0, transform.position, transform.position);
            mSyncTimeTick = 0.0f;
            mbMoved       = false;
        }
    }
Esempio n. 3
0
    public void MoveTo(Vector3 vPos, bool fromServer = false, MeetGoalCalllBack callBack = null)
    {
        meetGoalCasllBack = callBack;

        vPos.y        = this.transform.position.y;
        moveToPos     = vPos;
        moveDirection = (vPos - this.transform.position).normalized;

        if (mLoginModule.mRoleID == mxGUID && !fromServer)
        {
            mNetModule.RequireMove(mLoginModule.mRoleID, 0, moveToPos);
        }


        mAnima.PlayAnimaState(NFAnimaStateType.Run, -1);
    }