Exemplo n.º 1
0
    public void AddSyncData(int sequence, NFMsg.PosSyncUnit syncUnit)
    {
        Clear();

        Vector3 pos = new Vector3();
        Vector3 dir = new Vector3();

        if (syncUnit.Pos != null)
        {
            pos.x = syncUnit.Pos.X;
            pos.y = syncUnit.Pos.Y;
            pos.z = syncUnit.Pos.Z;
        }

        if (syncUnit.Orientation != null)
        {
            dir.x = syncUnit.Orientation.X;
            dir.y = syncUnit.Orientation.Y;
            dir.z = syncUnit.Orientation.Z;
        }

        var keyframe = new NFHeroSyncBuffer.Keyframe();

        keyframe.Position          = pos;
        keyframe.Director          = dir;
        keyframe.status            = syncUnit.Status;
        keyframe.InterpolationTime = sequence;

        if (mxSyncBuffer)
        {
            Debug.Log(keyframe.InterpolationTime + " move " + this.transform.position.ToString() + " TO " + keyframe.Position.ToString());

            mxSyncBuffer.AddKeyframe(keyframe);
        }
    }
Exemplo n.º 2
0
    public void AddSyncData(NFMsg.ReqAckPlayerPosSync reqAckPlayerPosSync)
    {
        Clear();

        for (int i = 0; i < reqAckPlayerPosSync.SyncUnit.Count; ++i)
        {
            NFMsg.PosSyncUnit syncUnit = reqAckPlayerPosSync.SyncUnit[i];
            Vector3           pos      = new Vector3();
            Vector3           dir      = new Vector3();
            pos.x = syncUnit.Pos.X;
            pos.y = syncUnit.Pos.Y;
            pos.z = syncUnit.Pos.Z;

            if (syncUnit.Direction != null)
            {
                dir.x = syncUnit.Direction.X;
                dir.y = syncUnit.Direction.Y;
                dir.z = syncUnit.Direction.Z;
            }

            var keyframe = new NFHeroSyncBuffer.Keyframe();
            keyframe.Position = pos;
            keyframe.Director = dir;
            keyframe.status   = syncUnit.Status;

            if (mxSyncBuffer)
            {
                mxSyncBuffer.AddKeyframe(keyframe);
            }
        }
    }
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:
                    if (keyframe.Position != Vector3.zero)
                    {
                        mxHeroMotor.MoveTo(keyframe.Position, MeetGoalCallBack);
                    }
                    break;

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

                default:
                    break;
                }
            }
        }
    }
Exemplo n.º 4
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;
                }
            }
        }
    }