/// <summary> /// 切换目标 /// </summary> /// <param name="id"></param> void SelectTargetChange(uint id) { //切换目标 IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es != null) { IPlayer m_curTarget = es.FindPlayer(id); if (m_curTarget != null) { //检测视野(策划要求不做视野检测) //if (es.CheckEntityVisible(m_curTarget)) //检测搜索范围 if (es.CheckSearchRange(m_curTarget)) { Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs != null) { //如果在挂机先停止(清任务目标),再开始,打指定目标 if (cs.GetCombatRobot().Status == CombatRobotStatus.RUNNING) { cs.GetCombatRobot().Stop(); cs.GetCombatRobot().Start(); } } Client.ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl().UpdateTarget(m_curTarget); Client.stTargetChange targetChange = new Client.stTargetChange(); targetChange.target = m_curTarget; Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLSYSYTEM_TAB, targetChange); // Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_TARGETCHANGE, targetChange); } else { TipsManager.Instance.ShowTips("目标不在附近"); } } else { TipsManager.Instance.ShowTips("目标不在附近"); } } }