Beispiel #1
0
 public void Update(KeyboardState pKeyboardState, KeyboardState pOldKeyboardState, Random pRandom, Texture2D pStarTexture, GraphicsDevice pGraphicsDevice, SoundEffect pKeySound, GameState pGameState)
 {
     myStarManager.addParticleStar(pRandom, pStarTexture, pGraphicsDevice, 0.1f);
     myStarManager.Update();
     if (CheckInput(pKeyboardState, pOldKeyboardState, Keys.Enter, pKeySound))
     {
         if (pGameState.rocketArrived < pGameState.targetRocketArrived)
         {
             result = "system";
         }
         else
         {
             result = "end";
         }
     }
     if (result == "system" || result == "end")
     {
         alpha -= 0.1f;
     }
 }
Beispiel #2
0
        public void UpdateMenu(MouseState pCurrentMouseState)
        {
            bool haveClicked = false;

            if (myGameState.musicEnabled)
            {
                sound_musicInstance.Play();
            }
            if (pCurrentMouseState.LeftButton == ButtonState.Pressed && oldMouseState.LeftButton == ButtonState.Released)
            {
                haveClicked = true;
            }
            Vector2 mPose = new Vector2(pCurrentMouseState.Position.X, pCurrentMouseState.Position.Y);

            myParticleStarManager.addParticleStar(myRandom, img_star, GraphicsDevice, 0.1f);
            myParticleStarManager.Update();

            string start_result    = menu_start.CheckInteraction(mPose, haveClicked, sound_clic, sound_clic);
            string settings_result = menu_settings.CheckInteraction(mPose, haveClicked, sound_clic, sound_clic);
            string exit_result     = menu_exit.CheckInteraction(mPose, haveClicked, sound_clic, sound_clic);

            Color highlighted  = Color.Crimson;
            Color defaultColor = Color.White;

            if (start_result == "over")
            {
                menu_start.color = highlighted;
            }
            else if (start_result == "start")
            {
                sound_clic.Play();
                mySystemGenerator.GenerateSystem(myRandom, GraphicsDevice, myGameState);
                currentState = "introduction";
            }
            else if (start_result == null)
            {
                menu_start.color = defaultColor;
            }
            if (settings_result == "over")
            {
                menu_settings.color = highlighted;
            }
            else if (settings_result == "settings")
            {
                sound_clic.Play();
                currentState = "settings";
            }
            else if (settings_result == null)
            {
                menu_settings.color = defaultColor;
            }
            if (exit_result == "over")
            {
                menu_exit.color = highlighted;
            }
            else if (exit_result == "exit")
            {
                sound_clic.Play();
                Exit();
            }
            else if (exit_result == null)
            {
                menu_exit.color = defaultColor;
            }
        }