So much audio stuff holy shit

This commit is contained in:
Gregory Campbell
2020-07-12 01:07:52 -04:00
parent d2c7bd90e1
commit e2aef2a35b
45 changed files with 275 additions and 58 deletions
+7
View File
@@ -5,12 +5,17 @@ using UnityEngine;
public class BulletScript : MonoBehaviour
{
public AudioClip[] hit;
private float speed;
private Rigidbody2D rb;
private ShakeScript shake;
private AudioSource audioSource;
void Start()
{
audioSource = GetComponent<AudioSource>();
rb = GetComponent<Rigidbody2D>();
speed = Random.Range(3.0f, 8.0f);
shake = GameObject.Find("Shake Manager").GetComponent<ShakeScript>();
@@ -29,6 +34,8 @@ public class BulletScript : MonoBehaviour
if(other.gameObject.tag != "Player" && other.gameObject.tag != "Bullet")
{
AudioSource.PlayClipAtPoint(
hit[Random.Range(0,hit.Length)], new Vector3(0, 0, 0));
Destroy(gameObject);
}