void UpdateFiring() { if (fireToggle) { lastShotTime += Time.deltaTime; if (lastShotTime >= 0.1) { ProjectileScript projectile = gunProjectile.GetComponent <ProjectileScript>(); Rigidbody2D rigidbody = GetComponent <Rigidbody2D>(); projectile.Fire(projectile, rigidbody.velocity); gunAudio.Play(); lastShotTime = 0; } } }