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; } } }
public static void SendStartMove() { StartMoveReq mStartMoveReq = new StartMoveReq(); mStartMoveReq.UserId = "" + GameEntry.NetData.mUserData.UserId; mStartMoveReq.RoomId = GameEntry.NetData.mFightData.RoomId; Send(mStartMoveReq); }
//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; } }