internal static void Execute(object msg, User user) { Msg_CR_UserMoveToPos move_msg = msg as Msg_CR_UserMoveToPos; if (move_msg == null) { return; } UserInfo charactor = user.Info; if (charactor == null) { LogSys.Log(LOG_TYPE.ERROR, "charactor {0} not exist", user.RoleId); return; } /// if (charactor.GetAIEnable()) { MovementStateInfo msi = charactor.GetMovementStateInfo(); msi.PositionX = move_msg.cur_pos_x; msi.PositionZ = move_msg.cur_pos_z; UserAiStateInfo asi = charactor.GetAiStateInfo(); Vector3 pos = new Vector3(move_msg.target_pos_x, 0, move_msg.target_pos_z); asi.TargetPos = pos; asi.IsTargetPosChanged = true; asi.ChangeToState((int)(AiStateId.Move)); } }
internal void SyncPlayerMoveToPos(float tx, float tz, float x, float z) { Msg_CR_UserMoveToPos builder = new Msg_CR_UserMoveToPos(); builder.target_pos_x = tx; builder.target_pos_z = tz; builder.cur_pos_x = x; builder.cur_pos_z = z; SendMessage(builder); }
internal void SyncPlayerMoveToPos(ScriptRuntime.Vector3 target_pos) { EntityInfo userInfo = PluginFramework.Instance.GetEntityById(PluginFramework.Instance.RoomObjId); if (null != userInfo) { MovementStateInfo msi = userInfo.GetMovementStateInfo(); Msg_CR_UserMoveToPos builder = new Msg_CR_UserMoveToPos(); builder.target_pos = ToPosition(target_pos.X, target_pos.Z); SendMessage(RoomMessageDefine.Msg_CR_UserMoveToPos, builder); } }
internal void SyncPlayerMoveToPos(ScriptRuntime.Vector3 target_pos) { EntityInfo userInfo = ClientModule.Instance.GetEntityById(ClientModule.Instance.LeaderID); if (null != userInfo) { MovementStateInfo msi = userInfo.GetMovementStateInfo(); Msg_CR_UserMoveToPos builder = new Msg_CR_UserMoveToPos(); builder.target_pos = ProtoHelper.EncodePosition2D(target_pos.X, target_pos.Z); SendMessage(RoomMessageDefine.Msg_CR_UserMoveToPos, builder); } }
internal void SyncPlayerStopMove() { EntityInfo userInfo = PluginFramework.Instance.GetEntityById(PluginFramework.Instance.RoomObjId); if (null != userInfo) { MovementStateInfo msi = userInfo.GetMovementStateInfo(); Msg_CR_UserMoveToPos builder = new Msg_CR_UserMoveToPos(); builder.target_pos = ToPosition(msi.PositionX, msi.PositionZ); builder.is_stop = true; SendMessage(RoomMessageDefine.Msg_CR_UserMoveToPos, builder); } }
internal void SyncPlayerStopMove() { EntityInfo userInfo = ClientModule.Instance.GetEntityById(ClientModule.Instance.LeaderID); if (null != userInfo) { MovementStateInfo msi = userInfo.GetMovementStateInfo(); Msg_CR_UserMoveToPos builder = new Msg_CR_UserMoveToPos(); builder.target_pos = ProtoHelper.EncodePosition2D(msi.PositionX, msi.PositionZ); builder.is_stop = true; SendMessage(RoomMessageDefine.Msg_CR_UserMoveToPos, builder); } }
internal void SyncPlayerMoveToPos(Vector3 target_pos) { WorldSystem.Instance.IsAlreadyNotifyMeetObstacle = false; UserInfo userInfo = WorldSystem.Instance.GetPlayerSelf(); if (null != userInfo) { MovementStateInfo msi = userInfo.GetMovementStateInfo(); Msg_CR_UserMoveToPos builder = new Msg_CR_UserMoveToPos(); builder.target_pos_x = target_pos.X; builder.target_pos_z = target_pos.Z; builder.cur_pos_x = msi.PositionX; builder.cur_pos_z = msi.PositionZ; SendMessage(builder); } }
internal static void Execute(object msg, User user) { Msg_CR_UserMoveToPos move_msg = msg as Msg_CR_UserMoveToPos; if (move_msg == null) { return; } EntityInfo charactor = user.Info; if (charactor == null) { LogSys.Log(LOG_TYPE.DEBUG, "charactor {0}({1},{2},{3}) not exist", user.RoleId, user.GetKey(), user.Guid, user.Name); return; } /// if (charactor.GetAIEnable()) { float tx, tz; ProtoHelper.DecodePosition2D(move_msg.target_pos, out tx, out tz); ScriptRuntime.Vector3 pos = new ScriptRuntime.Vector3(tx, 0, tz); MovementStateInfo msi = charactor.GetMovementStateInfo(); msi.IsMoving = true; msi.TargetPosition = pos; float dir = Geometry.GetYRadian(msi.GetPosition3D(), pos); msi.SetFaceDir(dir); msi.SetMoveDir(dir); Msg_RC_NpcMove npcMoveBuilder = DataSyncUtility.BuildNpcMoveMessage(charactor); if (null != npcMoveBuilder) { Scene scene = user.OwnRoom.ActiveScene; if (null != scene) { scene.NotifyAllUser(RoomMessageDefine.Msg_RC_NpcMove, npcMoveBuilder); } } } }