private IEnumerator CompleteRoomEffects() { audio.PlaySound(43); // alarm 1 audio.ChangeSoundVolume(43, .5f); yield return(new WaitForSeconds(audio.GetSoundLength(43) + 3f)); // ~3.8s + 2s = ~5.8s audio.PlaySound(44); // alarm 2 audio.ChangeSoundVolume(44, .5f); yield return(new WaitForSeconds(audio.GetSoundLength(44) + 1f)); // + ~3.25s + 1s = ~10s audio.PlaySound(45); // explosion yield return(new WaitForSeconds(audio.GetSoundLength(45) + 3f)); // + ~8.5s + 3s = ~20.5s (start voice at 3.5s) lighting.SwitchAllLights(LightSetting.On); // reset room after some time yield return(new WaitForSeconds(DelayUntilRoomReset)); Room.Initialize(); }
public override void OnGameStateChanged(Game <IEtsInterface> sender, GameStateChangedEventArgs e) { if (sender != game) { return; } StopAllCoroutines(); audio.StopAllVoice(); audio.StopAllSounds(); switch (e.NewState) { case GameState.Initialized: lighting.SwitchAllLights(LightSetting.Off); firstCratePickedUp = false; firstCrateInDropzone = false; StartCoroutine(GameInitialized()); break; case GameState.Running: StartCoroutine(GameRunning(game)); break; case GameState.Completed: StartCoroutine(GameCompleted()); break; case GameState.Aborted: StartCoroutine(GameAborted(game)); break; case GameState.Uninitialized: case GameState.Error: break; default: throw new NotImplementedException("GameState not handled: " + e.NewState); } }