void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
// Use this for initialization void Start() { cardController = GetComponent <CardController> (); cardSounds = GetComponent <CardSounds> (); ambientSounds = GetComponent <AmbientSounds> (); ambientBackground = GetComponent <AmbientBackground> (); cardController.OnTrigger += HandleTrigger; SetupNewGame(); UpdateStory(); }
public void PlayAmbientSound(AmbientSounds sound) { AudioClip clip = null; if (ambientAudioSource == null) { return; } switch (sound) { case AmbientSounds.WorkReminder: clip = WorkReminderSound; break; case AmbientSounds.WantingBeer: clip = WantingBeerSound; break; case AmbientSounds.LowMotivation: clip = LowMotivationSound; break; case AmbientSounds.NoMoney: clip = NoMoneySound; break; case AmbientSounds.Hunger: clip = HungerSound; break; } if (clip != null) { if (!ambientAudioSource.isPlaying) { ambientAudioSource.PlayOneShot(clip); } } }