This commit is contained in:
DominikB
2023-06-24 15:13:52 +02:00
parent d8bbb48ccb
commit 2b0daa4e96
2 changed files with 101 additions and 0 deletions

View File

@@ -11,6 +11,8 @@ private EdgeCollider2D edge;
public float fadeTime;
public float refractoryTime;
private bool gone;
private AudioSource audioSource; // Reference to the AudioSource component
public AudioClip fadeSound; // The sound clip to be played
void Start()
@@ -19,6 +21,7 @@ private bool gone;
col = GetComponent<BoxCollider2D>();
edge = GetComponent<EdgeCollider2D>();
gone = false;
audioSource = GetComponent<AudioSource>();
}
void Update()
@@ -51,6 +54,7 @@ private bool gone;
col.enabled = false;
edge.enabled = false;
gone = true;
audioSource.PlayOneShot(fadeSound);
}
}