DLevel Sounds
This commit is contained in:
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user