void Update() { //gatling weapon firing if (weap == Weapon.Gatling) { //if the fire button is held down and enough time has passed since the last shot, fire and make noise if (Input.GetButton("Fire1") && Time.time > ps.nextFire) { ps.nextFire = Time.time + ps.fireRate; for (int i = 0; i < ps.numShots; i++) { Instantiate(shot, shotSpawn [i].position, Quaternion.identity); } au[0].PlayOneShot(au[0].clip); } } //homing weapon firing else if (weap == Weapon.LockOn) { //begin locking onto targets on button press if (Input.GetButtonDown("Fire1") && Time.time > ps.nextHoming) { ps.nextHoming = Time.time + ps.homingCD; loc.LockOn(); } //begin firing onto targets on button release if (Input.GetButtonUp("Fire1")) { if (loc.Fire()) { ps.nextHoming = Time.time + ps.homingCD; au [1].PlayOneShot(au [1].clip); } ; } } //if the player has powerups, let them cash in their powerups if (Input.GetButtonDown("Jump") && pc.powerupsHeld > 0) { pc.CashInPowerups(); } //change the polarity of the ship if (Input.GetButtonDown("Fire2")) { InvertPolarity(); } //change the weapon of the ship if (Input.GetButtonDown("Fire3") && !Input.GetButton("Fire1")) { ChangeWeapon(); } //read for invincibility if (ps.invincible && !timerOn) { BecomeInvincible(); } }