/// <summary> /// 单位移动 /// </summary> private void OnUnitMove(PacketBase packet) { ss2c.UnitMove msg = packet as ss2c.UnitMove; Unit unit = UnitManager.Instance.GetUnitByIdx(msg.unit_idx.obj_idx); if (unit != null) { unit.ModifyPos(msg.pos.x, msg.pos.y); } }
private void SendAOIMove(long char_idx, long move_unit_idx, int row, int col) { Player player = UnitManager.Instance.GetUnitByIdx(char_idx) as Player; if (player == null) { return; } Unit move_unit = UnitManager.Instance.GetUnitByIdx(move_unit_idx); if (move_unit == null) { return; } ss2c.UnitMove rep_msg = PacketPools.Get(ss2c.msg.UNIT_MOVE) as ss2c.UnitMove; rep_msg.unit_idx.Set(move_unit.unit_type, 0, move_unit.obj_idx); rep_msg.pos.Set(col, row); rep_msg.flags = 0; ServerNetManager.Instance.SendProxy(player.client_uid, rep_msg, false); PacketPools.Recover(rep_msg); }