Exemple #1
0
        protected override void Update(GameTime gameTime)
        {
            input.Update(gameTime);

            var state = new GuiInputState
            {
                Point    = input.CursorPosition,
                Pressed  = input.SelectPressed,
                Released = input.SelectReleased,
            };

            grid.Update(state, gameTime.ElapsedGameTime);
            base.Update(gameTime);
        }
        protected override void OnUpdateFrame(FrameEventArgs e)
        {
            input.Update();

            var state = new GuiInputState
            {
                Point    = input.CursorPosition,
                Pressed  = input.SelectPressed,
                Released = !input.SelectPressed,
            };

            grid.Update(state, TimeSpan.FromSeconds(e.Time));
            base.OnUpdateFrame(e);
        }
        public void Update(GuiInputState state, TimeSpan span)
        {
            // update the visible pieces so they get updated right away
            UpdateVisiblePieces();

            // immediately add the waves of invaders (if necessary)
            AddInvaders();

            // update the gui
            mGui.Update(state, span);

            // construct new updata parameters for the functions
            UpdateParams uparams = new UpdateParams(span, InputProvider.GetState(), MiddleOffset + Position);

            // update the list
            UpdateSelectionList(uparams);

            // update the selection the user has made
            UpdateSelection(uparams);

            // process any requests from the user for a piece
            ProcessInput(uparams);

            // update the description text that is displayed
            UpdateDescriptionText(uparams);

            // update the radius around the selected piece
            UpdateSelectedPieceRadius(uparams);

            // update all pieces
            UpdatePieces(uparams);

            // update all invaliders
            UpdateInvaders(uparams);

            // update the piece targets
            UpdatePieceTargets(uparams);

            // update all projectiles
            UpdateProjectiles(uparams);

            // finally, update the time
            Player.TimeUntilInvadersArrive -= span;
        }