public void move(Variant msgData) { uint @uint = msgData["iid"]._uint; ProfessionRole otherPlayer = OtherPlayerMgr._inst.GetOtherPlayer(@uint); bool flag = otherPlayer != null; if (flag) { float x = msgData["to_x"]._float / 53.333f; float z = msgData["to_y"]._float / 53.333f; Vector3 vector = new Vector3(x, otherPlayer.m_curModel.position.y, z); bool flag2 = GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3342u]; if (flag2) { otherPlayer.SetDestPos(vector); } else { NavMeshHit navMeshHit; NavMesh.SamplePosition(vector, out navMeshHit, 100f, otherPlayer.m_layer); otherPlayer.SetDestPos(navMeshHit.position); } } else { float x2 = msgData["to_x"]._float / 53.333f; float z2 = msgData["to_y"]._float / 53.333f; MonsterRole serverMonster = MonsterMgr._inst.getServerMonster(@uint); bool flag3 = serverMonster != null; if (flag3) { Vector3 vector2 = new Vector3(x2, serverMonster.m_curModel.position.y, z2); bool flag4 = GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3342u]; if (flag4) { serverMonster.SetDestPos(vector2); } else { NavMeshHit navMeshHit2; NavMesh.SamplePosition(vector2, out navMeshHit2, 100f, serverMonster.m_layer); serverMonster.SetDestPos(navMeshHit2.position); } } } }
public void move(Variant msgData) { //RoleMgr._instance.onMove(msgData); uint iid = msgData["iid"]._uint; ProfessionRole pr = OtherPlayerMgr._inst.GetOtherPlayer(iid); if (a3_insideui_fb.instance != null && PlayerModel.getInstance().inFb) { a3_insideui_fb.instance.Cancel(); } if (pr != null) { float to_x = msgData["to_x"]._float / GameConstant.PIXEL_TRANS_UNITYPOS; float to_y = msgData["to_y"]._float / GameConstant.PIXEL_TRANS_UNITYPOS; Vector3 vec = new Vector3(to_x, pr.m_curModel.position.y, to_y); if (GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3342]) {//解决多层阻挡点寻路的问题 pr.SetDestPos(vec); } else { NavMeshHit hit; NavMesh.SamplePosition(vec, out hit, 100f, pr.m_layer); pr.SetDestPos(hit.position); } } else { float to_x = msgData["to_x"]._float / GameConstant.PIXEL_TRANS_UNITYPOS; float to_y = msgData["to_y"]._float / GameConstant.PIXEL_TRANS_UNITYPOS; MonsterRole role = MonsterMgr._inst.getServerMonster(iid); if (role != null) { Vector3 vec = new Vector3(to_x, role.m_curModel.position.y, to_y); if (GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3342] || GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3358]) {//解决多层阻挡点寻路的问题 role.SetDestPos(vec); } else { NavMeshHit hit; NavMesh.SamplePosition(vec, out hit, 100f, role.m_layer); role.SetDestPos(hit.position); } } } //LGAvatarGameInst to = getRoleByIID(data["iid"]); //if (to == null) return; //to.addMoving(data); //Variant moveinfo = new Variant(); //if (data == null || !data.ContainsKey("to_x")) //{ // GameTools.PrintError("addMoving err!"); // return; //} ////debug.Log("收到移动消息 " + data.dump()); //float to_x = data["to_x"]._float / GameConstant.PIXEL_TRANS_UNITYPOS; //float to_y = data["to_y"]._float / GameConstant.PIXEL_TRANS_UNITYPOS; //debug.Log("收到移动消息 " + to_x + " " + to_y); ////setMoveInfo(moveinfo); }