void Update() { if (Input.GetMouseButtonDown(0)) { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, 100f)) { if (hit.transform.tag == "poster") { screenStart.transform.localPosition = new Vector3( hit.transform.localPosition.x - 0.01f, 5.88f, hit.transform.localPosition.z ); } if (hit.transform.tag == "playButton") { this.DestroyScreenChooseGame(); this.InitGame(); } if (hit.transform.tag == "closeButton") { this.DestroyGame(); this.InitFinal(); } if (hit.transform.tag == "buyButton") { Application.OpenURL("https://www.meloman.ru/calendar/?hall=koncertnyj-zal-chajkovskogo"); } if (hit.transform.tag == "exitButton") { this.DestroyFinal(); this.InitScreenChooseGame(); } AnotherKey key = hit.transform.GetComponent <AnotherKey>(); if (key != null) { if (key.readyToScore) { Debug.Log("Good hit"); key.GoodHit(); } else { Debug.Log("Bad hit"); key.BadHit(); } } } } }
private void OnTriggerExit(Collider other) { AnotherKey key = other.GetComponent <AnotherKey>(); if (key != null) { key.Die(); } }
private void OnTriggerEnter(Collider other) { AnotherKey key = other.GetComponent <AnotherKey>(); if (key != null) { key.readyToScore = true; } }