DLevel Sounds
This commit is contained in:
parent
9c043b51cb
commit
ba6e8cd54e
@ -14,11 +14,14 @@ public bool einsAn = false;
|
||||
public GameObject _LevelManager1;
|
||||
private keyWhenPressed script1;
|
||||
bool isActivated;
|
||||
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()
|
||||
{
|
||||
originalPointPosition = movingPoint.transform.position;
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@ -36,6 +39,9 @@ void OnTriggerEnter2D(Collider2D other) {
|
||||
if (other.CompareTag("PressurePlatable") || other.CompareTag("PlayerIsOnIt")){
|
||||
spriteRenderer.sprite = activatedSprite;
|
||||
movingPoint.transform.position = activatedPointPosition;
|
||||
|
||||
audioSource.PlayOneShot(pressedSound);
|
||||
|
||||
einsAn = true;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
@ -11,10 +11,12 @@ public Sprite activatedSprite;
|
||||
public bool startActivated = false;
|
||||
private Collider2D Stein = null;
|
||||
public bool zweiAn = 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(!zweiAn){
|
||||
audioSource.PlayOneShot(pressedSound);
|
||||
}
|
||||
zweiAn = true;
|
||||
|
||||
}
|
||||
|
@ -11,6 +11,8 @@ public class keyWhenPressed : MonoBehaviour
|
||||
private ButtonDTwo script2;
|
||||
public GameObject _LevelManager3;
|
||||
private ButtonDThree script3;
|
||||
private AudioSource audioSource; // Reference to the AudioSource component
|
||||
public AudioClip keyAppearSound; // The sound clip to be played
|
||||
|
||||
public bool isActivated;
|
||||
|
||||
@ -18,6 +20,7 @@ public class keyWhenPressed : MonoBehaviour
|
||||
{
|
||||
// Disable the object by default
|
||||
objectToActivate.SetActive(false);
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
|
||||
}
|
||||
|
||||
@ -33,6 +36,7 @@ public class keyWhenPressed : MonoBehaviour
|
||||
if (eins && zwei && drei && !isActivated)
|
||||
{
|
||||
// Activate the object
|
||||
audioSource.PlayOneShot(keyAppearSound);
|
||||
objectToActivate.SetActive(true);
|
||||
isActivated = true;
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3512dddf54c8f2d4c8406d418d09c0b9
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
x
Reference in New Issue
Block a user