Пример #1
0
        public void MsgHandle(List <Packet> list)
        {
            for (int i = 0; i < list.Count; i++)
            {
                int    packId      = list[i].Id;
                Packet framePacket = list[i];
                switch (packId)
                {
                case 1006:
                    StartMoveReq startMoveReq = (StartMoveReq)framePacket;
                    Process(startMoveReq);
                    break;

                case 1008:
                    ChangeDirReq changeDirReq = (ChangeDirReq)framePacket;
                    Process(changeDirReq);
                    break;

                case 1010:
                    EndMoveReq endMoveReq = (EndMoveReq)framePacket;
                    Process(endMoveReq);
                    break;

                    //case 1016:
                    //    TransformReq transformReq = (TransformReq)framePacket;
                    //    Process(transformReq);
                    //    break;
                }
            }
        }
Пример #2
0
        public static void SendStartMove()
        {
            StartMoveReq mStartMoveReq = new StartMoveReq();

            mStartMoveReq.UserId = "" + GameEntry.NetData.mUserData.UserId;
            mStartMoveReq.RoomId = GameEntry.NetData.mFightData.RoomId;
            Send(mStartMoveReq);
        }
Пример #3
0
        //private void Process(TransformReq transformReq) {
        //    // transformReq handle
        //    string userId = transformReq.UserId;
        //    Tank tank = GameEntry.LockManager.GetActor(userId);
        //    if (tank != null) {
        //        tank.updateTransform = true;
        //        // 每一帧刷新tank坐标和朝向
        //        tank.PositionX = transformReq.PositionX;
        //        tank.PositionZ = transformReq.PositionZ;
        //        tank.RotationY = transformReq.RotationY;
        //    }
        //}

        private void Process(StartMoveReq startMoveReq)
        {
            // StartMoveReq handle
            string userId = startMoveReq.UserId;
            Tank   tank   = GameEntry.LockManager.GetActor(userId);

            if (tank != null)
            {
                tank.GetComponentInChildren <Thruster>().X = 0;
                tank.GetComponentInChildren <Thruster>().Y = 0;
            }
        }