public void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player" && reloadFrames >= SHOOTING_SPEED * 60) { cannon.Fire(); reloadFrames = 0; } }
private void Update() { Vector2 mouseWorldPos = Camera.main.ScreenToWorldPoint(Input.mousePosition); cannon.SetPosition(mouseWorldPos.x); if (Input.GetButton("Fire1")) { cannon.Fire(); } }
void OnTriggerEnter(Collider collision) { if (collision.tag == "Torch") { if (collision.gameObject.GetComponent <torch>().GetLit() == true) { myAudioSource.Play(); myFuseEmitter.Play(); myCannonScript.Fire(); } } }
// Update is called once per frame void Update() { if (Input.GetKey("e") && shootingDelay >= SHOOTING_SPEED * 60) { cannonRight.Fire(); shootingDelay = 0; } if (Input.GetKey("q") && shootingDelay >= SHOOTING_SPEED * 60) { cannonLeft.Fire(); shootingDelay = 0; } shootingDelay += 1; }