// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Space)) { beko_manager.GiveGrassToRandomBeko(); } if (Input.GetMouseButtonDown(0)) { Ray ray = new Ray(); RaycastHit hit = new RaycastHit(); ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray.origin, ray.direction, out hit, Mathf.Infinity)) { Debug.Log("OK"); if (hit.collider.gameObject.CompareTag("beko")) { beko_manager.RemoveBeko(hit.collider.gameObject); } } } }
// Update is called once per frame void Update() { vt += Time.deltaTime; life_time -= Time.deltaTime; if (life_time <= 0f) { beko_manager.RemoveBeko(this.gameObject); } if (!release_flg) { Moving(); audio_source.clip = moving_voice; } else { audio_source.clip = throw_voice; } if (vt > voice_time) { audio_source.Play(); vt = 0f; } }