void Update() { if (Input.GetMouseButtonDown(0)) { bulletAmt--; if (bulletCount < 3) { bulletCount++; gui.DisableBullet(bulletCount); } if (bulletAmt <= 0) { Game_manager.OnDuckMiss(); } Vector3 mousePos = Input.mousePosition; mousePos.z = Camera.main.transform.position.z; if (Physics.Raycast(Camera.main.ScreenToWorldPoint(mousePos), Camera.main.transform.forward, out hit, Mathf.Infinity)) { if (hit.transform.tag == "Duck") { hit.transform.GetComponent <Duck_Health>().KillDuck(); } } } }
public void DirectionChanger(Vector3 _dir) { direction = new Vector3(direction.x * _dir.x, direction.y * _dir.y); bounce++; if (bounce >= bounceMax) { direction = new Vector3(0, 1, 0); Game_manager.OnDuckMiss(); } }