Beispiel #1
0
        public void Update(GameTime gameTime)
        {
            if (StartTime == 0)
            {
                StartTime = gameTime.TotalGameTime.TotalMilliseconds;
                ProgressManager.ArgentDernierePartie = 0;
            }
            else
            {
                if (gameTime.TotalGameTime.TotalMilliseconds - StartTime > 180000)//2 minutes
                {
                    ProgressManager.ArgentDernierePartie = (int)(1.1 * ProgressManager.ArgentDernierePartie);
                    ProgressManager.Argent += ProgressManager.ArgentDernierePartie;
                    // if (ProgressManager.LvlDebloque < 1)
                    {
                        ProgressManager.LvlDebloque += 1;
                    }
                    Game1.SetPartieDeJeu((int)TypesDePartieDeJeu.Gagne);
                }
                else
                {
                    ProgressManager.TempsSurvecuDernierePartie = gameTime.TotalGameTime.TotalMilliseconds - StartTime;
                }
            }


            _wrapper.MouseX = Mouse.GetState().X;
            _wrapper.MouseY = Mouse.GetState().Y;
            _wrapper.State  = 0;
            if (Keyboard.GetState().IsKeyDown(Keys.Up) || Keyboard.GetState().IsKeyDown(Keys.W))
            {
                _wrapper.State |= KeyState.Up;
            }
            if (Keyboard.GetState().IsKeyDown(Keys.Down) || Keyboard.GetState().IsKeyDown(Keys.S))
            {
                _wrapper.State |= KeyState.Down;
            }
            if (Keyboard.GetState().IsKeyDown(Keys.Left) || Keyboard.GetState().IsKeyDown(Keys.A))
            {
                _wrapper.State |= KeyState.Left;
            }
            if (Keyboard.GetState().IsKeyDown(Keys.Right) || Keyboard.GetState().IsKeyDown(Keys.D))
            {
                _wrapper.State |= KeyState.Right;
            }
            _wrapper.ToggleSpace(Keyboard.GetState().IsKeyDown(Keys.Space));

            if (Keyboard.GetState().IsKeyDown(Keys.R))
            {
                m_Joueur.CurrentWeapon().Reload();
            }

            if (Mouse.GetState().LeftButton == ButtonState.Pressed)
            {
                if (!MouseDown)
                {
                    m_Joueur.CurrentWeapon().MouseDown();
                    MouseDown = true;
                }
            }
            else
            {
                if (MouseDown)
                {
                    m_Joueur.CurrentWeapon().MouseUp();
                    MouseDown = false;
                }
            }



            EntityManager.Instance.TickPlayer(0, gameTime, _wrapper);
            _wrapper.ResetSpace();
            EntityManager.Instance.TickEntities(gameTime);
        }