private GetEntityById ( int id ) : |
||
id | int | |
return |
internal static void Execute(object msg, User user) { Msg_CR_Skill use_skill = msg as Msg_CR_Skill; if (null == use_skill) { return; } EntityInfo userObj = user.Info; if (null == userObj) { LogSys.Log(LOG_TYPE.DEBUG, "UseSkillHandler, charactor {0}({1},{2},{3}) not exist", user.RoleId, user.GetKey(), user.Guid, user.Name); return; } Scene scene = user.OwnRoom.ActiveScene; if (null != scene) { EntityInfo obj = scene.GetEntityById(use_skill.role_id); if (null != obj) { AiStateInfo aiInfo = obj.GetAiStateInfo(); if (use_skill.target_id > 0) { aiInfo.Target = use_skill.target_id; } else if (use_skill.target_dir > 0) { float dir = ProtoHelper.DecodeFloat(use_skill.target_dir); obj.GetMovementStateInfo().SetFaceDir(dir); aiInfo.Target = 0; } if (aiInfo.AiLogic == (int)AiStateLogicId.Entity_Leader) { AiData_Leader data = aiInfo.AiDatas.GetData <AiData_Leader>(); if (null == data) { data = new AiData_Leader(); aiInfo.AiDatas.AddData(data); } data.ManualSkillId = use_skill.skill_id; } else { AiData_General data = aiInfo.AiDatas.GetData <AiData_General>(); if (null == data) { data = new AiData_General(); aiInfo.AiDatas.AddData(data); } data.ManualSkillId = use_skill.skill_id; } aiInfo.ChangeToState((int)AiStateId.SkillCommand); } } }
public static void Execute(object msg, User user) { Msg_CR_Skill use_skill = msg as Msg_CR_Skill; if (null == use_skill) { return; } EntityInfo userObj = user.Info; if (null == userObj) { LogSys.Log(LOG_TYPE.DEBUG, "UseSkillHandler, charactor {0}({1},{2},{3}) not exist", user.RoleId, user.GetKey(), user.Guid, user.Name); return; } Scene scene = user.OwnRoomUserManager.ActiveScene; if (null != scene) { EntityInfo obj = scene.GetEntityById(use_skill.role_id); if (null != obj) { AiStateInfo aiInfo = obj.GetAiStateInfo(); if (use_skill.target_id > 0) { aiInfo.Target = use_skill.target_id; } else if (use_skill.target_dir > 0) { float dir = use_skill.target_dir; obj.GetMovementStateInfo().SetFaceDir(dir); aiInfo.Target = 0; } Msg_RC_NpcSkill retMsg = DataSyncUtility.BuildNpcSkillMessage(obj, use_skill.skill_id); scene.NotifyAllUser(RoomMessageDefine.Msg_RC_NpcSkill, retMsg); } } }