Ejemplo n.º 1
0
        protected override void Update(GameTime gameTime)
        {
            var deltaTime     = gameTime.GetElapsedSeconds();
            var keyboardState = Keyboard.GetState();

            if (keyboardState.IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            _progressBar.Progress += deltaTime * _progressDelta;

            if (_progressBar.Progress >= 1.1f)
            {
                _progressDelta = -_progressDelta;
            }
            else if (_progressBar.Progress <= -0.1f)
            {
                _progressDelta = -_progressDelta;
            }

            _guiSystem.Update(gameTime);

            base.Update(gameTime);
        }
Ejemplo n.º 2
0
        // Manage the GUI here, all the buttons and player input.
        public void Update(GameTime gameTime)
        {
            backgroundManager.Update();

            CurrentKeyboardState = Keyboard.GetState();
            // Button actions go here
            if ((CurrentKeyboardState.IsKeyUp(Keys.Enter) && PreviousKeyboardState.IsKeyDown(Keys.Enter)) || (CurrentKeyboardState.IsKeyUp(Keys.E) &&
                                                                                                              PreviousKeyboardState.IsKeyDown(Keys.E)))
            {
                if (btnNewGame.IsSelected)
                {
                    Game1.gameState = GameState.Playing;
                }

                //if (btnOptions.IsSelected)
                //Game1.gameState = Game1.GameState.OptionsMenu;

                if (btnExit.IsSelected)
                {
                    Game1.gameState = GameState.Exiting;
                }
            }
            PreviousKeyboardState = Keyboard.GetState();
            guiSystem.Update();
        }
Ejemplo n.º 3
0
        public override void Update(GameTime gameTime)
        {
            guiSystem.Update(gameTime);

            var provider = CultureInfo.CurrentCulture;

            // sync
            textBoxR.Text = Nocubeless.Player.NextColorToLay.Red.ToString(provider);
            textBoxG.Text = Nocubeless.Player.NextColorToLay.Green.ToString(provider);
            textBoxB.Text = Nocubeless.Player.NextColorToLay.Blue.ToString(provider);

            #region Text Boxes
            textBoxR.Update(gameTime);
            textBoxG.Update(gameTime);
            textBoxB.Update(gameTime);

            try // textBox Picker Event
            {
                int r = Convert.ToInt32(textBoxR.Text.ToString(provider), provider),
                    g = Convert.ToInt32(textBoxG.Text.ToString(provider), provider),
                    b = Convert.ToInt32(textBoxB.Text.ToString(provider), provider);

                var newColor = new CubeColor(r, g, b);

                Nocubeless.Player.NextColorToLay = newColor;
            }
            catch (FormatException) { } // conversion error (e.g. is not a number)
            #endregion

            base.Update(gameTime);
        }
Ejemplo n.º 4
0
        public void Update(GameTime gameTime, GraphicsDevice graphicsDevice)
        {
            guiSystem.Update();

            // Update the Scrollable Lists


            ChallengeSelectionList.Update(gameTime);
        }
Ejemplo n.º 5
0
        protected override void Update(GameTime gameTime)
        {
            var keyboardState = Keyboard.GetState();

            if (keyboardState.IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            _guiSystem.Update(gameTime);
        }
Ejemplo n.º 6
0
        protected override void Update(GameTime gameTime)
        {
            var deltaTime     = gameTime.GetElapsedSeconds();
            var keyboardState = Keyboard.GetState();

            if (keyboardState.IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            _guiSystem.Update(gameTime);
            base.Update(gameTime);
        }
Ejemplo n.º 7
0
        internal override void UpdateScene(GameTime gameTime)
        {
            var keyboardState = KeyboardExtended.GetState();

            if (keyboardState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Enter))
            {
                ProtoHelper.WriteToChat(chatText.Text);
                var t = text.Get <Text>();
                t.text = $"{ProtoHelper.nickname}: {chatText.Text}";
            }

            _guiSystem.Update(gameTime);
        }
Ejemplo n.º 8
0
 public void Update(GameTime gameTime)
 {
     guiSystem.Update();
     CurrentKeyboardState = Keyboard.GetState();
     if ((CurrentKeyboardState.IsKeyUp(Keys.Enter) && PreviousKeyboardState.IsKeyDown(Keys.Enter)) || (CurrentKeyboardState.IsKeyUp(Keys.E) && PreviousKeyboardState.IsKeyDown(Keys.E)))
     {
         if (btnControlUp.IsSelected)
         {
             if (btnReturn.IsSelected)
             {
                 Game1.gameState = GameState.StartMenu;
             }
         }
     }
     PreviousKeyboardState = Keyboard.GetState();
 }
Ejemplo n.º 9
0
        protected override void Update(GameTime gameTime)
        {
            var keyboardState = Keyboard.GetState();

            if (keyboardState.IsKeyDown(Keys.Escape) && _previousKeyboardState.IsKeyUp(Keys.Escape))
            {
                Back();
            }

            _fpsCounter.Update(gameTime);
            _guiSystem.Update(gameTime);
            _currentDemo?.OnUpdate(gameTime);

            _previousKeyboardState = keyboardState;
            base.Update(gameTime);
        }
Ejemplo n.º 10
0
        public void Update(GameTime gameTime, GraphicsDevice graphicsDevice)
        {
            backgroundManager.Update();
            CurrentKeyboardState = Keyboard.GetState();
            // Button actions go here
            if ((CurrentKeyboardState.IsKeyUp(Keys.Enter) && PreviousKeyboardState.IsKeyDown(Keys.Enter)) || (CurrentKeyboardState.IsKeyUp(Keys.E) &&
                                                                                                              PreviousKeyboardState.IsKeyDown(Keys.E)))
            {
                if (btnBack.IsSelected)
                {
                    Game1.gameState = GameState.StartMenu;
                }
            }
            PreviousKeyboardState = Keyboard.GetState();

            guiSystem.Update();
        }
Ejemplo n.º 11
0
 public void Update(GameTime gameTime)
 {
     activeScreen.Update(gameTime);
     guiSystem.Update(gameTime);
 }
Ejemplo n.º 12
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)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                if (uiDismissed)
                {
                    uiDismissed = false;
                    _gui.ActiveScreen.Show();
                }
            }

            //gui stuff
            _gui.Update(gameTime);

            if (!uiDismissed)
            {
                return;
            }

            //updt paddle
            if (!bothAI)
            {
                usery = (int)(Mouse.GetState().Position.Y - (paddleh / 2.0));
            }

            if (allowDrag)
            {
                if (Mouse.GetState().LeftButton == ButtonState.Pressed)
                {
                    ballpos = Mouse.GetState().Position.ToVector2();
                }
            }

            //ball hit bounds
            if (ballpos.Y <= 0 || ballpos.Y + balld >= GraphicsDevice.Viewport.Height)
            {
                ballvel.Y *= -1;
            }
            if (ballpos.X <= 0 || ballpos.X + balld >= GraphicsDevice.Viewport.Width)
            {
                ballvel.X *= -1;
            }

            //collide with paddle
            if (ballpos.X + balld + ballvel.X >= (GraphicsDevice.Viewport.Width - paddlew))
            {
                //ball our side
                if ((ballpos.Y > usery) && (ballpos.Y < (usery + paddleh)))
                {
                    if (angleRandomisation)
                    {
                        ballvel.X *= r.Next(-130, -80) / 100f;
                    }
                    else
                    {
                        ballvel.X *= -1;
                    }
                }
                else
                {
                    //they score
                    othersc += 1;
                    ballvel  = new Vector2(5 * ballspeed, 5 * ballspeed);
                    ResetBallPos();
                    return;
                }
            }
            else if (ballpos.X + ballvel.X <= paddlew)
            {
                //ball their side
                if ((ballpos.Y > othery) && (ballpos.Y < (othery + paddleh)))
                {
                    if (angleRandomisation)
                    {
                        ballvel.X *= r.Next(-130, -80) / 100f;
                    }
                    else
                    {
                        ballvel.X *= -1;
                    }
                }
                else
                {
                    //we score
                    usersc += 1;
                    ballvel = new Vector2(-5 * ballspeed, 5 * ballspeed);
                    ResetBallPos();
                    return;
                }
            }

            //AI
            DoAdvancedAI(Math.Max(15.0 * MathHelper.ToPol(ballvel).Item2, 50));

            //apply vel to ball
            ballpos.X += ballvel.X;
            ballpos.Y += ballvel.Y;

            base.Update(gameTime);
        }
Ejemplo n.º 13
0
 internal override void UpdateScene(GameTime gameTime)
 {
     _guiSystem.Update(gameTime);
 }
Ejemplo n.º 14
0
    public override void Update(GameTime gameTime)
    {
        guiSystem.ActiveScreen.IsVisible = sharedContext.ShowDebugInfo;

        guiSystem.Update(gameTime);
    }
Ejemplo n.º 15
0
 public void Update(GameTime gameTime)
 {
     _guiSystem.Update(gameTime);
 }