/// <summary> /// Plays a sound according to the enum passed in. /// </summary> /// <param name="soundToPlay"></param> public void playSound(InGameSounds soundToPlay) { switch (soundToPlay) { case InGameSounds.Chomp: chomp.Play(); break; case InGameSounds.Death: death.Play(); break; case InGameSounds.EatFruit: eatFruit.Play(); break; case InGameSounds.EatGhost: eatGhost.Play(); break; case InGameSounds.EatPowerUp: eatPowerPill.Play(); playMusic(InGameMusic.PowerSiren); break; case InGameSounds.NoSound: break; } }
private void Awake() { AudioSources = new List <AudioSource>(); inGameSounds = GetComponentInChildren <InGameSounds>(); extGameSounds = GetComponentInChildren <ExtGameSounds>(); LoadAllAudioSources(); LoadAudioMixData(); }
// Use this for initialization void Start() { _sounds = GetComponent <InGameSounds>(); _escapePoint = EscapeGate.transform.position; _spawnPoint = transform.position; _player = GetComponent <Player>(); _cameraShaker = GetComponent <CameraShaker>(); InvokeRepeating("Spawn", 0, EverySecondSpawn); }