public void PlayPauseSound() { if (GameStateMachine.Instance.GameState.ToString() == "SuperMario.GameStates.PausedState") { if (OverWorldInstance.State == SoundState.Playing) { OverWorldInstance.Pause(); } else if (UndergroundInstance.State == SoundState.Playing) { UndergroundInstance.Pause(); } else if (StarInstance.State == SoundState.Playing) { StarInstance.Pause(); } else if (TimeRunningOutOverworldInstance.State == SoundState.Playing) { TimeRunningOutOverworldInstance.Pause(); } else if (TimeRunningOutStarInstance.State == SoundState.Playing) { TimeRunningOutStarInstance.Pause(); } } else if (GameStateMachine.Instance.GameState.ToString() == "SuperMario.GameStates.PlayingState") { if (OverWorldInstance.State == SoundState.Paused) { OverWorldInstance.Resume(); } else if (UndergroundInstance.State == SoundState.Paused) { UndergroundInstance.Resume(); } else if (StarInstance.State == SoundState.Paused) { StarInstance.Resume(); } else if (TimeRunningOutOverworldInstance.State == SoundState.Paused) { TimeRunningOutOverworldInstance.Resume(); } else if (TimeRunningOutStarInstance.State == SoundState.Paused) { TimeRunningOutStarInstance.Resume(); } } GamePause.Play(); }
public void PlayTimeWarning() { if (OverWorldInstance.State == SoundState.Playing) { OverWorldInstance.Stop(); } else if (StarInstance.State == SoundState.Playing) { StarInstance.Stop(); } TimeWarningInstance.Play(); }
public void BackgroundMusic() { // create instance for star music if (GameStateMachine.Instance.GameState.ToString() != "SuperMario.GameStates.PlayingState" || Mario.Instance.PlayableObjectState.ToString() == "SuperMario.MarioStates.DeadMario") { StarInstance.Stop(); OverWorldInstance.Stop(); UndergroundInstance.Stop(); TimeRunningOutOverworldInstance.Stop(); TimeRunningOutStarInstance.Stop(); DubstepInstance.Stop(); if (!levelCompleteSoundOnce && GameStateMachine.Instance.GameState.ToString() == "SuperMario.GameStates.EndLevelState") { LevelCompleteInstance.Play(); levelCompleteSoundOnce = true; } } /* Dubstep music for being on Yoshi. * else if (Mario.Instance.OnYoshi && DubstepInstance.State != SoundState.Playing) * { * StarInstance.Stop(); * OverWorldInstance.Stop(); * UndergroundInstance.Stop(); * TimeRunningOutOverworldInstance.Stop(); * TimeRunningOutStarInstance.Stop(); * * DubstepInstance.Play(); * } */ else if (!Mario.Instance.OnYoshi) { if (DubstepInstance.State == SoundState.Playing) { DubstepInstance.Stop(); } if (Mario.Instance.InCoinRoom) { if (UndergroundInstance.State != SoundState.Playing && !Mario.Instance.StarPower) { OverWorldInstance.Stop(); UndergroundInstance.Play(); } } else if (!Mario.Instance.IsSlidingOnPole) { if (!Mario.Instance.InCoinRoom && UndergroundInstance.State == SoundState.Playing) { UndergroundInstance.Stop(); OverWorldInstance.Play(); } else if (!Mario.Instance.StarPower && OverWorldInstance.State != SoundState.Playing && !HUD.Instance.TimeIsLow) { StarInstance.Stop(); if (!Mario.Instance.InCoinRoom) { OverWorldInstance.Play(); } } else if (Mario.Instance.StarPower && OverWorldInstance.State == SoundState.Playing && !HUD.Instance.TimeIsLow) { OverWorldInstance.Stop(); StarInstance.Play(); } else if (HUD.Instance.TimeIsLow && TimeWarningInstance.State != SoundState.Playing) { if (Mario.Instance.StarPower && TimeRunningOutStarInstance.State != SoundState.Playing) { TimeRunningOutOverworldInstance.Stop(); TimeRunningOutStarInstance.Play(); } else if (!Mario.Instance.StarPower && TimeRunningOutOverworldInstance.State != SoundState.Playing) { TimeRunningOutStarInstance.Stop(); TimeRunningOutOverworldInstance.Play(); } } } } }