public void PauseBeamSounds()
        {
            if (turretWeapon.firetype != Weapon.fireType.Beam)
            {
                return;
            }

            if (laserCue == null)
            {
                return;
            }

            if (laserCue.IsPaused)
            {
                return;
            }

            try
            {
                laserCue.Pause();
            }
            catch
            {
            }
        }
Example #2
0
 public void StopEngineSound()
 {
     if (engineSound != null && engineSound.IsPlaying)
     {
         engineSound.Pause();
     }
 }
Example #3
0
        public void Toggle(string cueName)
        {
            if (cues.ContainsKey(cueName))
            {
                Cue cue = cues[cueName];

                if (cue.IsPaused)
                {
                    cue.Resume();
                }
                else if (cue.IsPlaying)
                {
                    cue.Pause();
                }
                else //played but stopped
                {
                    //need to reget cue if stopped
                    Play(cueName);
                }
            }
            else //never played, need to reget cue
            {
                Play(cueName);
            }
        }
Example #4
0
 /// <summary>
 /// Pause background music
 /// </summary>
 public static void PauseBackgroundMusic()
 {
     if (backgroundMusic.IsPlaying)
     {
         backgroundMusic.Pause();
     }
 }
        private void EndGame(Player winner)
        {
            if (backgroundSound.IsPlaying)
            {
                backgroundSound.Pause();
            }

            humanControl.Stop();

            // Build menu

            List <MenuIcon> options = new List <MenuIcon>(1);
            MenuIcon        cancel  = new MenuIcon("");

            cancel.region = new GUIRegion(Recellection.windowHandle,
                                          new System.Windows.Rect(0, Globals.VIEWPORT_HEIGHT - 100, Globals.VIEWPORT_WIDTH, 100));
            options.Add(cancel);
            Menu menu = new Menu(options);

            MenuController.LoadMenu(menu);

            Recellection.CurrentState = new EndGameView(!(winner is AIPlayer));

            MenuController.GetInput();

            MenuController.UnloadMenu();
        }
Example #6
0
 /// <summary>
 /// Verifica quais teclas estão sendo pressionadas e realiza alguma ação de acordo (quando necessário)
 /// </summary>
 private void handleInput()
 {
     if (KeyboardHelper.IsKeyDown(Keys.Escape))
     {
         KeyboardHelper.LockKey(Keys.Escape);
         if (!answeredAll)
         {
             PauseState ps = (PauseState)parent.getState((int)StatesIdList.PAUSE);
             if (parent.EnterState((int)StatesIdList.PAUSE))
             {
                 ps.TutorialVisible = true;
                 if (!bgm.IsStopped)
                 {
                     bgm.Pause();
                 }
                 Alpha = 0.5f;
                 goManager.R3D.Alpha = goManager.R2D.Alpha = Alpha;
                 stateEntered        = false;
             }
         }
     }
     else if (KeyboardHelper.KeyReleased(Keys.Escape))
     {
         KeyboardHelper.UnlockKey(Keys.Escape);
     }
 }
 public virtual void PauseSound()
 {
     if (cue != null && cue.IsPlaying)
     {
         cue.Pause();
     }
 }
Example #8
0
 public void pause()
 {
     if (!cue.IsPaused)
     {
         cue.Pause();
     }
 }
Example #9
0
 /// <summary>
 /// Pauses playback of this sound
 /// </summary>
 #endregion
 public void Pause()
 {
     if (mCue.IsPlaying)
     {
         mCue.Pause();
     }
 }
Example #10
0
 public void TriggerBossEvent()
 {
     mBossEvent = true;
     mMusic.Pause();
     mBossMusic = mSounds.GetCue("boss_music");
     mMusicName = mBossMusic.Name;
     mBossMusic.Play();
 }
Example #11
0
        //pauses a 2D cue
        public void PauseCue(string cueName)
        {
            Cue cue = this.soundBank.GetCue(cueName);

            if ((cue != null) && (cue.IsPlaying))
            {
                cue.Pause();
            }
        }
Example #12
0
        public void Pause()
        {
            if (cue.IsPaused)
            {
                return;
            }

            cue.Pause();
        }
Example #13
0
        private void ControlSound(String fxName, String state)
        {
            Song soundEffect    = null;
            Cue  soundEffectCue = null;


            if (strArry != null)
            {
                //String check = "";
                //int index = -1;


                for (int i = 0; i < strArry.Length; i++)
                {
                    if (strArry[i].Contains(fxName))
                    {
                        if (fxName.Equals("invasion") || fxName.Equals("roughThemeSmall"))
                        {
                            //index = j;
                            soundEffect = soundArray.ElementAt <Song>(i);

                            if (state.Equals(EventList.PlaySound))
                            {
                                MediaPlayer.Play(soundEffect);
                            }
                            else if (state.Equals(EventList.PauseSound))    // && soundEffect.IsPlaying)
                            {
                                MediaPlayer.Pause();
                            }

                            else if (state.Equals(EventList.StopSound))    // && soundEffect.IsPlaying)
                            {
                                MediaPlayer.Stop();
                            }
                        }
                        else
                        {
                            soundEffectCue = soundBank.GetCue(strArry[i]);

                            if (state.Equals(EventList.PlaySound))
                            {
                                soundEffectCue.Play();
                            }
                            else if (state.Equals(EventList.PauseSound) && soundEffectCue.IsPlaying)
                            {
                                soundEffectCue.Pause();
                            }

                            else if (state.Equals(EventList.StopSound) && soundEffectCue.IsPlaying)
                            {
                                soundEffectCue.Stop(AudioStopOptions.AsAuthored);
                            }
                        }
                    }
                }
            }
        }
Example #14
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            //Блок управления проигрыванием по нажатию клавиш
            //При нажатии клавиши A приостанавливаем проигрывание
            KeyboardState kbState = Keyboard.GetState();

            if (kbState.IsKeyDown(Keys.A))
            {
                musicCue.Pause();
            }
            //При нажатии клавиши S продолжаем проигрывание музыки
            if (kbState.IsKeyDown(Keys.S))
            {
                musicCue.Resume();
            }
            //При нажатии клавиши D переходим на следующую песню
            if (kbState.IsKeyDown(Keys.D))
            {
                countDPress++;
                if (countDPress == 1) //Для того, чтобы переключение происходило только 1 раз при нажатии
                {
                    if (curSong < numberOfSongs)
                    {
                        curSong++;
                    }
                    else
                    {
                        curSong = 1;
                    }
                    musicCue.Stop(AudioStopOptions.Immediate);
                    musicCue = soundBank.GetCue(curSong.ToString());
                    musicCue.Play();
                }
            }
            if (kbState.IsKeyUp(Keys.D))
            {
                countDPress = 0;
            }

            if (!isGameRun)
            {
                musicCue.Stop(AudioStopOptions.Immediate);
            }

            audioEngine.Update();

            base.Update(gameTime);
        }
Example #15
0
 public override void PauseRoom()
 {
     foreach (var current in m_rainFG)
     {
         current.PauseAnimation();
     }
     if (m_rainSFX != null)
     {
         m_rainSFX.Pause();
     }
 }
Example #16
0
 public void Pause()
 {
     if (modMusic != null)
     {
         modMusic.Pause();
     }
     else
     {
         cue.Pause();
     }
 }
Example #17
0
        /// <summary>
        /// Pause Background Music
        /// </summary>
        public void PauseBgMusic()
        {
            if (!isInitialized)
            {
                MessageBox.Show("Audio System Not Initialized !", "Error !");
            }

            if (bgMusic != null && bgMusic.IsPlaying)
            {
                bgMusic.Pause();
            }
        }
Example #18
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here

            scoreField = new ScoreField(Content, GraphicsDevice, currentLevel);

            playerTank = new PlayerTank(Content, "playertank1");

            enemyTankSprite1 = Content.Load <Texture2D>("enemytank1");
            enemyTankSprite2 = Content.Load <Texture2D>("enemytank2");

            bulletSprite = Content.Load <Texture2D>("bulletSprite");

            levelData = Content.Load <LevelData[]>("levelData");

            tilesSprite = Content.Load <Texture2D>("minitiles");

            // load audio content
            audioEngine = new AudioEngine(@"Content\GameAudio.xgs");
            waveBank    = new WaveBank(audioEngine, @"Content\Wave Bank.xwb");
            soundBank   = new SoundBank(audioEngine, @"Content\Sound Bank.xsb");

            cuePlayerMove = soundBank.GetCue("w6_playerMove");

            cueEnemyMove = soundBank.GetCue("w13_enemyMove");
            cueEnemyMove.Play();
            cueEnemyMove.Pause();

            menuScreen      = new MenuScreen(Content);
            scoreScreen     = new ScoreScreen(Content, currentLevel, soundBank);
            nextLevelScreen = new NextLevel(Content, GraphicsDevice, currentLevel);
            endGameScreen   = new EndGameScreen(Content);

            scoreSprite           = Content.Load <Texture2D>("scoreSprite");
            gameOverDrawRectangle = new Rectangle(
                GameConstants.TILE_WIDTH * (GameConstants.FIELD_WIDTH_TILES / 2) - GameConstants.SMALL_TILE_WIDTH,
                GameConstants.FIELD_HEIGHT,
                GameConstants.TILE_WIDTH * 2, GameConstants.TILE_WIDTH);
            gameOverSourceRectangle = new Rectangle(
                0, GameConstants.TILE_WIDTH + GameConstants.SMALL_TILE_WIDTH,
                GameConstants.TILE_WIDTH * 2, GameConstants.TILE_WIDTH);

            pauseDrawRectangle = new Rectangle(
                GameConstants.TILE_WIDTH * (GameConstants.FIELD_WIDTH_TILES / 2) - GameConstants.SMALL_TILE_WIDTH,
                GameConstants.GAME_OVER_Y_POSITION,
                GameConstants.TILE_WIDTH * 2, GameConstants.SMALL_TILE_WIDTH);
            pauseSourceRectangle = new Rectangle(
                0, GameConstants.TILE_WIDTH,
                GameConstants.TILE_WIDTH * 2 + GameConstants.SMALL_TILE_WIDTH, GameConstants.SMALL_TILE_WIDTH);
        }
Example #19
0
        /// <summary>
        /// Allows the unit to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>>
        public override void Update(GameTime gameTime)
        {
            KeyboardState keyboard = Keyboard.GetState();

            musicCountdown -= gameTime.ElapsedGameTime.Milliseconds;
            if (musicCountdown <= 0)
            {
                if (keyboard.IsKeyDown(Keys.M))
                {
                    if (trackCue.IsPaused)
                    {
                        trackCue.Resume();
                    }
                    else
                    {
                        trackCue.Pause();
                    }
                    musicCountdown = musicDelay;
                }
                else
                {
                    musicCountdown = 0;
                }
            }

            foreach (Event ev in events)
            {
                switch (ev.EventId)
                {
                case (int)MyEvent.C_ATTACK_BULLET_END:  soundBank.PlayCue("shot"); break;

                case (int)MyEvent.G_NextLevel: levelCompleteCue.Play(); levelCompleteRunning = true; break;

                case (int)MyEvent.M_HIT:                soundBank.PlayCue("monsterHit"); break;

                case (int)MyEvent.M_BITE:               soundBank.PlayCue("Bite"); break;

                case (int)MyEvent.G_GameOver:           soundBank.PlayCue("ScreamAndDie"); break;
                }
            }

            if (levelCompleteRunning && levelCompleteCue.IsStopped)
            {
                levelCompleteRunning = false;
                myGame.mediator.fireEvent(MyEvent.G_NextLevel_END_OF_MUSIC);
            }
            events.Clear();
            base.Update(gameTime);
        }
        public AudioManager(Game1 game)
            : base(game)
        {
            myGame = game;
            events = new List <Event>();
            game.mediator.register(this, MyEvent.C_ATTACK_BULLET_END, MyEvent.M_BITE, MyEvent.G_GameOver);


            audioEngine = new AudioEngine(@"Content\Audio\GameAudio.xgs");
            waveBank    = new WaveBank(audioEngine, @"Content\Audio\Wave Bank.xwb");
            soundBank   = new SoundBank(audioEngine, @"Content\Audio\Sound Bank.xsb");

            trackCue = soundBank.GetCue("Cowboy");
            trackCue.Play();
            trackCue.Pause();
        }
Example #21
0
 public override void PauseRoom()
 {
     foreach (var current in m_rainFG)
     {
         current.PauseAnimation();
     }
     if (m_rainSFX != null)
     {
         m_rainSFX.Pause();
     }
     m_enchantress.PauseAnimation();
     m_blacksmith.PauseAnimation();
     m_architect.PauseAnimation();
     m_tollCollector.PauseAnimation();
     base.PauseRoom();
 }
Example #22
0
 public void Pause(Cue cue)
 {
     if (cue.IsPaused)
     {
         cue.Resume();
     }
     else if (cue.IsPlaying)
     {
         cue.Pause();
     }
     else
     {
         // If stopped, create a new cue.
         cue = soundBank.GetCue(cue.Name);
         cue.Play();
     }
 }
Example #23
0
 private void resetGame()
 {
     currentWorld.Reset = false;
     //gameState = GameState.Start;
     gameView.gateMissed  = new bool[4];
     gameView.prevGates   = new float[4];
     gameLevelControllers = new LevelController[NUM_LEVELS];
     for (int i = 0; i < NUM_LEVELS; i++)
     {
         gameLevelControllers[i] = new LevelController();
     }
     // gameState = GameState.ChooseLevel;
     base.Initialize();
     //base.Update(gameTime);
     menuCue = soundBank.GetCue("menu_music");
     menuCue.Play();
     menuCue.Pause();
 }
Example #24
0
        protected void UpdateInput()
        {
            // Get the game pad state.
            GamePadState currentState = GamePad.GetState(PlayerIndex.One);

            if (currentState.IsConnected)
            {
                ship.Update(currentState);

                // Set some audio based on whether we're pressing a trigger.
                if (currentState.Triggers.Right > 0)
                {
                    if (engineSound == null)
                    {
                        engineSound = soundBank.GetCue("engine_2");
                        engineSound.Play();
                    }

                    else if (engineSound.IsPaused)
                    {
                        engineSound.Resume();
                    }
                }
                else
                {
                    if (engineSound != null && engineSound.IsPlaying)
                    {
                        engineSound.Pause();
                    }
                }

                // In case you get lost, press B to warp back to the center.
                if (currentState.Buttons.B == ButtonState.Pressed)
                {
                    ship.Position = Vector3.Zero;
                    ship.Velocity = Vector3.Zero;
                    ship.Rotation = 0.0f;
                    ship.isActive = true;

                    // Make a sound when we warp.
                    soundBank.PlayCue("hyperspace_activate");
                }
            }
        }
Example #25
0
        private Cue FixCue(SoundBank newSoundBank, Cue cue)
        {
            Cue fixedCue = null;

            if (cue != null)
            {
                fixedCue = newSoundBank.GetCue(cue.Name);
                if (cue.IsPaused)
                {
                    fixedCue.Play();
                    fixedCue.Pause();
                }
                if (cue.IsPlaying)
                {
                    fixedCue.Play();
                }
            }
            return(fixedCue);
        }
        public override void Update(GameTime gameTime)
        {
            KeyboardState keyboard = Keyboard.GetState();

            musicCountdown -= gameTime.ElapsedGameTime.Milliseconds;
            if (musicCountdown <= 0)
            {
                if (keyboard.IsKeyDown(Keys.M))
                {
                    if (trackCue.IsPaused)
                    {
                        trackCue.Resume();
                    }
                    else
                    {
                        trackCue.Pause();
                    }
                    musicCountdown = musicDelay;
                }
                else
                {
                    musicCountdown = 0;
                }
            }

            foreach (Event ev in events)
            {
                switch (ev.EventId)
                {
                case (int)MyEvent.C_ATTACK_BULLET_END:  soundBank.PlayCue("shot"); break;

                case (int)MyEvent.M_BITE:               soundBank.PlayCue("Bite"); break;

                case (int)MyEvent.G_GameOver:           soundBank.PlayCue("ScreamAndDie"); break;
                }
            }

            events.Clear();
            base.Update(gameTime);
        }
Example #27
0
        /// <summary>
        /// Handles the FadeIn/FadeOut states.
        /// </summary>
        private void FadeValue(float elaspedTime)
        {
            _FadeTimer += elaspedTime;
            float musicVolume = MathHelper.Clamp(_FadeTimer / _FadeDuration, 0f, 1f);

            switch (_FadeState)
            {
            case FadeStates.FadeIn:
                SetVariable(MUSIC_VOLUME_VARIABLE, musicVolume);
                if (_FadeTimer >= _FadeDuration)
                {
                    _FadeState = FadeStates.None;
                }
                break;

            case FadeStates.FadeOutPause:
                SetVariable(MUSIC_VOLUME_VARIABLE, 1f - musicVolume);
                if (_FadeTimer >= _FadeDuration)
                {
                    _FadeState = FadeStates.None;
                    Cue.Pause();
                    _IsPausing = false;
                }
                break;

            case FadeStates.FadeOutStop:
                SetVariable(MUSIC_VOLUME_VARIABLE, 1f - musicVolume);
                if (_FadeTimer >= _FadeDuration)
                {
                    Cue.Stop(AudioStopOptions.AsAuthored);
                    _FadeState = FadeStates.None;
                    _IsStopped = true;
                }
                break;

            default:
                break;
            }
        }
Example #28
0
 /// <summary>
 /// Pauses the sound
 /// </summary>
 public void Pause()
 {
     sound.Pause();
 }
Example #29
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            GamePadState  newpadState   = GamePad.GetState(PlayerIndex.One);
            KeyboardState keyboardState = Keyboard.GetState(); //setting the getstate to keyboardstate

            previousMouseState = Mouse.GetState();             //setting the getstate to the previousMousestate
            mouseState         = Mouse.GetState();             //setting the getstate to the mousestate
            mouseX             = mouseState.X;                 //setting the mouse X position
            mouseY             = mouseState.Y;                 //setting the mouse Y position
            //  if (keyboardState.IsKeyDown(Keys.Enter) || (mouseState.LeftButton == ButtonState.Pressed && previousMouseState.LeftButton == ButtonState.Pressed || (GamePad.GetState(PlayerIndex.One).Buttons.Start == ButtonState.Pressed)))
            // {
            if (game == 1)
            {      //play
                if (Keyboard.GetState().IsKeyDown(Keys.Enter) || (GamePad.GetState(PlayerIndex.One).Buttons.Start == ButtonState.Pressed))
                {
                    Sonya.playerPosition   = new Vector2(100f, 400f);
                    SubZero.playerPosition = new Vector2(1050f, 400f);

                    selection.Play(1f, .1f, .5f);
                    timer = 99;

                    SonyaHealth = 550;
                    SubZHealth  = 550;
                    SonyaGreenBar.update(SonyaHealth);
                    SubZGreenBar.update(SonyaHealth);
                    Sonya.playerAnimation.playerPos   = new Vector2(100f, 400f);
                    SubZero.playerAnimation.playerPos = new Vector2(1050f, 400f);
                    Sonya.looping   = true;
                    SubZero.looping = true;
                    Sonya.playerAnimation.flipHorizontal   = false;
                    SubZero.playerAnimation.flipHorizontal = true;
                    endMenuTimer      = 100;
                    drawBars          = true;
                    gameEnded         = false;
                    Sonya.gameEnded   = false;
                    SubZero.gameEnded = false;
                    Sonya.playerAnimation.currentFrame   = Vector2.Zero;
                    SubZero.playerAnimation.currentFrame = Vector2.Zero;
                    game = 2;
                }
            }
            if (game == 2)
            {      //return
                if ((GamePad.GetState(PlayerIndex.One).Buttons.A == ButtonState.Pressed))
                {
                    selection.Play(1f, .1f, .5f);
                    game = 3;
                }
            }
            if (game == 4)
            {      //play
                if ((GamePad.GetState(PlayerIndex.One).Buttons.A == ButtonState.Pressed))
                {
                    selection.Play(1f, .1f, .5f);
                    game = 3;
                }
            }
            if (game == 5)
            {      //play
                if (Keyboard.GetState().IsKeyDown(Keys.Enter) || (GamePad.GetState(PlayerIndex.One).Buttons.A == ButtonState.Pressed))
                {
                    selection.Play(1f, .1f, .5f);

                    player1     = 0;
                    player2     = 0;
                    SonyaHealth = 550;
                    SubZHealth  = 550;

                    musicCue.Resume();
                    game = 1;
                }

                //quit
                if ((GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed))
                {
                    selection.Play(1f, .1f, .5f);
                    this.Exit();
                }
            }

            //   }
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                this.Exit();
            }

            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            if (game == 3)
            {
                Sonya.Update(gameTime);
                SubZero.Update(gameTime);

                if (Sonya.playerAnimation.playerPos.X > SubZero.playerAnimation.playerPos.X &&
                    Sonya.currentState == (int)Sprite.Idle)
                {
                    Sonya.playerAnimation.flipHorizontal = true;
                }

                if (Sonya.playerAnimation.playerPos.X < SubZero.playerAnimation.playerPos.X &&
                    Sonya.currentState == (int)Sprite.Idle)
                {
                    Sonya.playerAnimation.flipHorizontal = false;
                }

                if (SubZero.playerAnimation.playerPos.X < Sonya.playerAnimation.playerPos.X &&
                    SubZero.currentState == (int)Sprite.Idle)
                {
                    SubZero.playerAnimation.flipHorizontal = false;
                }

                if (SubZero.playerAnimation.playerPos.X > Sonya.playerAnimation.playerPos.X &&
                    SubZero.currentState == (int)Sprite.Idle)
                {
                    SubZero.playerAnimation.flipHorizontal = true;
                }

                // clock start and update
                if (clock.isRunning == false)
                {
                    //count 10 seconds down
                    clock.start(timer);
                }
                else
                {
                    clock.checkTime(gameTime);
                }
            }
            //keyboard controls
            //if (game == 3 || game == 4)
            //{
            //    if (keyboardState.IsKeyDown(Keys.P))
            //    {
            //        game = 4;
            //    }
            //    if (keyboardState.IsKeyDown(Keys.R))
            //    {
            //        game = 3;
            //    }
            //}

            if (game == 3)
            {
                if ((GamePad.GetState(PlayerIndex.One).Buttons.Start == ButtonState.Pressed))
                {
                    game = 4;
                }
            }

            // Test if Sonya Gets Attacked //
            SonyaHealthEffect = collision.TestCollision(Sonya.sonyaHitBox.playerHB, SubZero.subZAttackHB.playerHB,
                                                        Sonya.currentState, SubZero.currentState);

            if (SonyaHealthEffect > 10)
            {
                Sonya.beenHit = true;
            }

            if (SonyaHealthEffect != 0 && SonyaHealth != 0)
            {
                if (Sonya.playerPosition.X > SubZero.playerPosition.X)
                {
                    Sonya.playerAnimation.playerPos.X += pushBack;
                    Sonya.playerPosition.X            += pushBack;//Sonya.playerAnimation.playerPos;
                    if (Sonya.playerPosition.X >= graphics.PreferredBackBufferWidth - 135)
                    {
                        Sonya.playerAnimation.playerPos.X = graphics.PreferredBackBufferWidth - 135;
                        Sonya.playerPosition.X            = graphics.PreferredBackBufferWidth - 135;
                    }
                }
                else
                {
                    Sonya.playerAnimation.playerPos.X -= pushBack;
                    Sonya.playerPosition.X            -= pushBack;//Sonya.playerAnimation.playerPos;
                    if (Sonya.playerPosition.X <= 0)
                    {
                        Sonya.playerAnimation.playerPos.X = 0;
                        Sonya.playerPosition.X            = 0;
                    }
                }

                if (game == 3)
                {
                    S_hurt.Play(1f, .1f, .5f);
                }

                SonyaHealth -= SonyaHealthEffect;
                SonyaGreenBar.update(SonyaHealth);
            }
            // Test is Sub Gets Attacked //
            SubZeroHealthEffect = collision.TestCollision(SubZero.subZeroHitBox.playerHB, Sonya.sonyaAttackHB.playerHB,
                                                          SubZero.currentState, Sonya.currentState);

            if (SubZeroHealthEffect > 10)
            {
                SubZero.beenHit = true;
            }

            if (SubZeroHealthEffect != 0 && SubZHealth != 0)
            {
                if (Sonya.playerPosition.X > SubZero.playerPosition.X)
                {
                    SubZero.playerAnimation.playerPos.X -= pushBack;
                    SubZero.playerPosition.X            -= pushBack;
                    if (SubZero.playerPosition.X <= 0)
                    {
                        SubZero.playerAnimation.playerPos.X = 0;
                        SubZero.playerPosition.X            = 0;
                    }
                }
                else
                {
                    SubZero.playerAnimation.playerPos.X += pushBack;
                    SubZero.playerPosition.X            += pushBack;
                    if (SubZero.playerPosition.X >= graphics.PreferredBackBufferWidth - 140)
                    {
                        SubZero.playerAnimation.playerPos.X = graphics.PreferredBackBufferWidth - 140;
                        SubZero.playerPosition.X            = graphics.PreferredBackBufferWidth - 140;
                    }
                }

                if (game == 3)
                {
                    SZ_hurt.Play(1f, .1f, .5f);
                }
                SubZHealth -= SubZeroHealthEffect;
                SubZGreenBar.update(SubZHealth);
            }
            if (game == 3)
            {
                //clock runs out
                if (clock.isFinished)
                {
                    Sonya.gameEnded   = true;
                    SubZero.gameEnded = true;

                    if (SonyaHealth > SubZHealth)
                    {
                        player1         = 1;
                        Sonya.winGame   = true;
                        SubZero.winGame = false;
                    }
                    if (SubZHealth > SonyaHealth)
                    {
                        player2         = 1;
                        Sonya.winGame   = false;
                        SubZero.winGame = true;
                    }
                    musicCue.Pause();
                    game = 5;
                }
                if (SonyaHealth <= 0 || SubZHealth <= 0)
                {
                    Sonya.gameEnded   = true;
                    SubZero.gameEnded = true;

                    if (SonyaHealth <= 0)
                    {
                        player2         = 1;
                        Sonya.winGame   = false;
                        SubZero.winGame = true;
                    }

                    if (SubZHealth <= 0)
                    {
                        player1         = 1;
                        Sonya.winGame   = true;
                        SubZero.winGame = false;
                    }
                    musicCue.Pause();
                    clock.reset();
                    timer    = 0;
                    drawBars = false;

                    endMenuTimer -= (int)gameTime.ElapsedGameTime.TotalMilliseconds / 15;

                    if (endMenuTimer <= 0)
                    {
                        game = 5;
                    }
                }
            }
            base.Update(gameTime);
        }
Example #30
0
 public void PauseCurrentCue()
 {
     currentCue.Pause();
 }