Shoot sound

This commit is contained in:
JonatanRek
2020-02-01 20:21:41 +01:00
parent d256f7dd45
commit 8d1c4a02c2
2 changed files with 106 additions and 0 deletions

View File

@@ -16,6 +16,9 @@ public class WeaponManager : MonoBehaviour
public PlayerManager player;
public bool hit = false;
public AudioSource audioSource = new AudioSource();
public AudioClip shootSound;
// Start is called before the first frame update
void Start()
{
@@ -36,6 +39,7 @@ public class WeaponManager : MonoBehaviour
if (particleShoot != null && player.ammo > 1)
{
GameObject shoot = Instantiate(particleShoot, spawnShoot.transform.position, spawnShoot.transform.rotation);
audioSource.PlayOneShot(shootSound);
player.ammo -= 2;
Destroy(shoot, 0.3f);
fireTime = fireRate + Time.time;