void OnTriggerStay(Collider collision) // triggerがあるときはこれ { string myTag = gameObject.tag; // 自分自身のタグ if (audience.updateFlag == true) { if (myTag == collision.gameObject.tag) { seSounds[0].Play(); score.AddScore(); Destroy(collision.gameObject);// 衝突した方(寿司)のオブジェクトを破壊 audience.Back(); } } }
// Update is called once per frame void Update() { RaycastHit HIT; Ray rayspawn = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(rayspawn, out HIT)) { if (HIT.collider.gameObject.tag == ("enemy")) { if (Input.GetMouseButtonDown(0)) { HIT.collider.transform.gameObject.SetActive(false); SM.AddScore(1, 1); Debug.Log(HIT); } } Debug.Log(HIT); } pointer.transform.position = HIT.point + offset; }