Esempio n. 1
0
        public static void Initialize()
        {
            MenuMusic                = EntryPoint.Game.Content.Load <SoundEffect>("Menu\\MenuMusic");
            MenuMusicInstance        = MenuMusic.CreateInstance();
            MenuMusicInstance.Volume = 0.3f;
            MenuMusicInstance.Pitch  = -0.1f;

            MenuClick                = EntryPoint.Game.Content.Load <SoundEffect>("Menu\\MenuClick");
            MenuClickInstance        = MenuClick.CreateInstance();
            MenuClickInstance.Volume = 1;
            MenuClickInstance.Pitch  = 0.3f;

            IntroSong                = EntryPoint.Game.Content.Load <SoundEffect>("Intro\\IntroWav");
            IntroSongInstance        = IntroSong.CreateInstance();
            IntroSongInstance.Volume = 0.8f;

            BattleSong                = EntryPoint.Game.Content.Load <SoundEffect>("IngameAudio\\BattleSong");
            BattleSongInstance        = BattleSong.CreateInstance();
            BattleSongInstance.Volume = 0.05f;

            NarratorFightSound         = EntryPoint.Game.Content.Load <SoundEffect>("IngameAudio\\Fight");
            NarratorFightSoundInstance = NarratorFightSound.CreateInstance();

            ClarkPunch         = EntryPoint.Game.Content.Load <SoundEffect>("IngameAudio\\ClarkPunch");
            ClarkPunchInstance = ClarkPunch.CreateInstance();

            YuriPunch         = EntryPoint.Game.Content.Load <SoundEffect>("IngameAudio\\YuriPunch");
            YuriPunchInstance = YuriPunch.CreateInstance();

            YuriKick         = EntryPoint.Game.Content.Load <SoundEffect>("IngameAudio\\YuriKick");
            YuriKickInstance = YuriKick.CreateInstance();

            ClarkKick         = EntryPoint.Game.Content.Load <SoundEffect>("IngameAudio\\ClarkKick");
            ClarkKickInstance = ClarkKick.CreateInstance();

            BlockSound         = EntryPoint.Game.Content.Load <SoundEffect>("IngameAudio\\Block");
            BlockSoundInstance = BlockSound.CreateInstance();
        }
Esempio n. 2
0
        private void OnStateChange()
        {
            if (CurrentMusicInstance != null)
            {
                if (!(NextGameState == GameState.Menu && GameState == GameState.Menu))
                {
                    CurrentMusicInstance.Stop();
                }
                else if (CurrentMusicInstance.State == SoundState.Paused)
                {
                    CurrentMusicInstance.Play();
                }
            }

            if (NextGameState == GameState.GameOver) //Answer me Snake...Snake?! SNAKEEEEEEE!!!"
            {
                if (GameOverMenu.GameOverReason == GameOverReason.Win)
                {
                    CurrentScreen = GameWinMenu;
                    GameWinMenu.LastPlayerScore = Player.Score;
                }
                else
                {
                    CurrentScreen = GameOverMenu;
                    GameOverMenu.Awake();
                }

                GameState = GameState.Menu;
                Player.OnGameOver();
                LevelManager.OnGameOver();
                NextGameState = GameState.None;

                CurrentMusicInstance          = MenuMusic.CreateInstance();
                CurrentMusicInstance.IsLooped = true;
                CurrentMusicInstance.Play();
            }
            else
            {
                if (NextGameState == GameState.Menu)
                {
                    switch (NextUIType)
                    {
                    case UIType.MainMenu:
                    {
                        CurrentScreen = MainMenu;
                        break;
                    }

                    case UIType.LevelTransition:
                    {
                        LevelTransition.ResetState();
                        CurrentScreen = LevelTransition;
                        break;
                    }

                    case UIType.GameOver:
                    {
                        CurrentScreen = GameOverMenu;
                        break;
                    }

                    case UIType.Leaderboard:
                    {
                        CurrentScreen = Leaderboard;
                        break;
                    }

                    default:
                    {
                        break;
                    }
                    }
                }
                else if (NextGameState == GameState.Game)
                {
                    LevelManager.NextLevel();
                }
                else if (NextGameState == GameState.NewGame)
                {
                    NewGame();
                }

                if (NextGameState == GameState.Game)
                {
                    CurrentMusicInstance          = GameMusic.CreateInstance();
                    CurrentMusicInstance.IsLooped = true;
                }
                else if (CurrentMusicInstance == null || (GameState == GameState.Menu && CurrentScreen != LevelTransition && !(NextGameState == GameState.Menu && GameState == GameState.Menu)))
                {
                    CurrentMusicInstance          = MenuMusic.CreateInstance();
                    CurrentMusicInstance.IsLooped = true;
                    CurrentMusicInstance.Play();
                }

                GameState = NextGameState;
            }

            NextGameState = GameState.None;
            NextUIType    = UIType.None;
        }