DLevel Sounds

This commit is contained in:
DominikB
2023-06-24 14:57:13 +02:00
parent 9c043b51cb
commit ba6e8cd54e
5 changed files with 22 additions and 9 deletions

View File

@@ -11,10 +11,12 @@ public Sprite activatedSprite;
public bool startActivated = false;
private Collider2D Stein = null;
public bool dreiAn = false;
private AudioSource audioSource; // Reference to the AudioSource component
public AudioClip pressedSound; // The sound clip to be played
// Start is called before the first frame update
void Start()
{
audioSource = GetComponent<AudioSource>();
}
// Update is called once per frame
@@ -37,6 +39,9 @@ void OnTriggerEnter2D(Collider2D other) {
if (other.CompareTag("PressurePlatable")||other.CompareTag("Player")) {
startActivated = true;
spriteRenderer.sprite = activatedSprite;
if(!dreiAn){
audioSource.PlayOneShot(pressedSound);
}
dreiAn = true;
}