void AnalyseTouchPos_Click(Vector3 posPressed, Touch touch) { if ((m_SceneTouchFingerID == -1) || (m_SceneTouchFingerID != -1 && touch.fingerId == m_SceneTouchFingerID)) { if (!UIManager.IsSubUIShow()) { Ray ray = Camera.main.ScreenPointToRay(posPressed); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { if (touch.phase != TouchPhase.Ended) { //if (null != PlayerFrameLogic.Instance() && !PlayerFrameLogic.Instance().Fold) //{ //PlayerFrameLogic.Instance().m_PlayerHeadButton.gameObject.GetComponent<UIPlayTween>().Play(false); //PlayerFrameLogic.Instance().PlayerFrameHeadOnClick(); //} // 客户单物品 点击拾取 if (hit.collider.gameObject.CompareTag("CollectItem")) { Singleton <CollectItem> .GetInstance().RemoveItem(hit.collider.gameObject); GameEvent gameEvent = new GameEvent(Games.GlobeDefine.GameDefine_Globe.EVENT_DEFINE.EVENT_TOUCH_OBJECT); Singleton <EventSystem> .GetInstance().PushEvent(gameEvent); return; } Obj_MainPlayer _mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer; if (null == _mainPlayer) { return; } //Obj点击操作,单击点选目标,双击移动过去 Obj_Character npcScript = hit.collider.gameObject.GetComponent <Obj_Character>(); if (npcScript) { if (m_bIsMouseDBClick || Reputation.IsEnemy(npcScript)) { //npcScript.FaceTo(Singleton<ObjManager>.GetInstance().MainPlayer.transform.position); if (_mainPlayer.IsCanOperate_Move()) { _mainPlayer.BreakAutoCombatState(); _mainPlayer.LeaveTeamFollow(); _mainPlayer.MoveTo(hit.collider.gameObject.transform.position, hit.collider.gameObject, 1.0f); _mainPlayer.FaceTo(hit.collider.transform.position); _mainPlayer.OnSelectTarget(hit.collider.gameObject); _mainPlayer.HasSendpos = false; } else { if (!_mainPlayer.HasSendpos) { _mainPlayer.HasSendpos = true; _mainPlayer.SynCleanCacheSkillToServer(); _mainPlayer.LastForceSynPosTime = Time.time; } } } else { //选择目标 _mainPlayer.OnSelectTarget(hit.collider.gameObject); } GameEvent gameEvent = new GameEvent(Games.GlobeDefine.GameDefine_Globe.EVENT_DEFINE.EVENT_TOUCH_OBJECT); Singleton <EventSystem> .GetInstance().PushEvent(gameEvent); } } } } } return; }
void AnalyseMousePos_Click(Vector3 posPressed) { if (null != UICamera.mainCamera) { Ray nUIRay = UICamera.mainCamera.ScreenPointToRay(posPressed); RaycastHit nHit; if (Physics.Raycast(nUIRay, out nHit)) { if (nHit.collider.gameObject.CompareTag("SubUI") || nHit.collider.gameObject.CompareTag("UI")) { return; } } } if (!UIManager.IsSubUIShow()) { Ray ray = Camera.main.ScreenPointToRay(posPressed); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { // 客户单物品 点击拾取 if (hit.collider.gameObject.CompareTag("CollectItem")) { Singleton <CollectItem> .GetInstance().RemoveItem(hit.collider.gameObject); GameEvent gameEvent = new GameEvent(Games.GlobeDefine.GameDefine_Globe.EVENT_DEFINE.EVENT_TOUCH_OBJECT); Singleton <EventSystem> .GetInstance().PushEvent(gameEvent); return; } Obj_MainPlayer _mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer; if (null == _mainPlayer) { return; } //Obj点击操作,单击点选目标,双击移动过去 Obj_Character npcScript = hit.collider.gameObject.GetComponent <Obj_Character>(); if (npcScript) { if (m_bIsMouseDBClick || Reputation.IsEnemy(npcScript)) { if (_mainPlayer.IsCanOperate_Move()) { _mainPlayer.BreakAutoCombatState(); _mainPlayer.LeaveTeamFollow(); _mainPlayer.MoveTo(hit.collider.gameObject.transform.position, hit.collider.gameObject, 1.0f); _mainPlayer.FaceTo(hit.collider.transform.position); _mainPlayer.OnSelectTarget(hit.collider.gameObject); _mainPlayer.HasSendpos = false; } else { if (!_mainPlayer.HasSendpos) { _mainPlayer.HasSendpos = true; _mainPlayer.SynCleanCacheSkillToServer(); _mainPlayer.LastForceSynPosTime = Time.time; } } } else { //选择目标 _mainPlayer.OnSelectTarget(hit.collider.gameObject); } GameEvent gameEvent = new GameEvent(Games.GlobeDefine.GameDefine_Globe.EVENT_DEFINE.EVENT_TOUCH_OBJECT); Singleton <EventSystem> .GetInstance().PushEvent(gameEvent); } Obj_Mount mountScript = hit.collider.gameObject.GetComponent <Obj_Mount>(); if (null != mountScript) { if (mountScript.PlayerObj == null) { return; } //Obj_Character Obj_Char = mountScript.PlayerObj.gameObject.GetComponent<Obj_Character>(); //if (Obj_Char == null) //{ // return; //} if (m_bIsMouseDBClick || Reputation.IsEnemy(mountScript.PlayerObj)) { //npcScript.FaceTo(Singleton<ObjManager>.GetInstance().MainPlayer.transform.position); if (_mainPlayer.IsCanOperate_Move()) { _mainPlayer.BreakAutoCombatState(); _mainPlayer.LeaveTeamFollow(); _mainPlayer.MoveTo(mountScript.PlayerObj.gameObject.transform.position, hit.collider.gameObject, 1.0f); _mainPlayer.FaceTo(mountScript.PlayerObj.ObjTransform.position); _mainPlayer.OnSelectTarget(mountScript.PlayerObj.gameObject); _mainPlayer.HasSendpos = false; } else { if (!_mainPlayer.HasSendpos) { _mainPlayer.HasSendpos = true; _mainPlayer.SynCleanCacheSkillToServer(); _mainPlayer.LastForceSynPosTime = Time.time; } } } else { //选择目标 _mainPlayer.OnSelectTarget(mountScript.PlayerObj.gameObject); } } } } return; }