private void CheckClick() { bool hasToucEvent = false; Vector3 screenPosition = Vector3.zero;; #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WINRT || UNITY_BLACKBERRY) && !UNITY_EDITOR) int count = Input.touchCount; if (count > 0) { if (Input.GetTouch(0).phase == TouchPhase.Began) { hasToucEvent = true; screenPosition = Input.GetTouch(0).position; } } #else if (Input.GetMouseButtonDown(0)) { hasToucEvent = true; screenPosition = Input.mousePosition; } #endif if (hasToucEvent) { GameObject overGO = GetFirstUIElement(screenPosition); if (overGO != null) { return; } Ray ray = Camera.main.ScreenPointToRay(screenPosition); RaycastHit hit; bool isHit = Physics.Raycast(ray, out hit, 10000, 1 << GameConstVal.BossLayer | 1 << GameConstVal.MainRoleLayer); if (isHit) { //if (hit.collider.gameObject.CompareTag(GameConstVal.NPCTag)) //{ // // 奇异博士需要特殊处理 // if (hit.collider.gameObject.name == "Npc_drstrange") // { // bool finishStep5 = Global.gApp.gSystemMgr.GetCampGuidMgr().GetStepFinished(4); // if (finishStep5) // { // OpenWeaponRaiseUi(); // return; // } // } // else if (hit.collider.gameObject.name == "Npc_recycle") // { // bool finishStep4 = Global.gApp.gSystemMgr.GetCampGuidMgr().GetStepFinished(3); // if (finishStep4) // { // OpenMatBg(); // return; // } // } // else if (hit.collider.gameObject.name == "Npc_oldwoman") // { // bool finishStep5 = Global.gApp.gSystemMgr.GetCampGuidMgr().GetStepFinished(4); // if (finishStep5) // { // OpenCampTaskDetails(); // return; // } // } // NpcBehavior monster = hit.collider.gameObject.GetComponentInParent<NpcBehavior>(); // if (monster != null) // { // monster.RespondClick(); // } //} //else if (hit.collider.gameObject.name == "BadgeNode") //{ // OpenBadge(); //} //点击 主角 的处理 //else if (hit.collider.gameObject.CompareTag(GameConstVal.MainRoleTag)) //{ // if (m_GuardRewardNodeComp != null) // { // m_GuardRewardNodeComp.AddReward(); // } //} if (hit.collider.gameObject.CompareTag(GameConstVal.NPCTag)) { CampsiteNpcPoint point = hit.collider.gameObject.GetComponent <CampsiteNpcPoint>(); point.RespondClick(); } } } }
public void SetLinkNpc(CampsiteNpcPoint npcPoint) { this.linkNpcPoint = npcPoint; }