void Start() { if (AudioScript == null) { AudioScript = this; } if (SoundEffect == null) { SoundEffect = GetComponent <AudioSource>(); } }
void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { StaticAudio.PlaySound(); if (gameObject.tag == "YellowCoin") { SwitchScript.OnCoinPickup(); } else if (gameObject.tag == "BlueCoin") { GameManager.GM.MM.Display("Congratulations!"); GameManager.GM.MM.RefreshPeriod = 0; } Destroy(gameObject); } }