コード例 #1
0
        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();
        }