Пример #1
0
        public override void Update(GameTime gameTime)
        {
            var keystate = Keyboard.GetState();

            if (_collectorOrbs.Count < 5)
            {
                GenerateCollectors(5 - _collectorOrbs.Count);
            }

            _player.Update(gameTime);
            foreach (var orb in _collectorOrbs)
            {
                orb.Update(gameTime, _player);
            }

            _collectorOrbs = _collectorOrbs.Where(o => !o.IsFinished).ToList();


            _countdown -= gameTime.ElapsedGameTime;

            if (_countdown.TotalMilliseconds <= 0)
            {
                TriggerEnd("Time is up", Color.Gray);
            }

            if (keystate.IsKeyUp(Keys.P) && _oldState.IsKeyDown(Keys.P))
            {
                Finished  = true;
                NextState = new MainMenuState(game);
            }

            _oldState = keystate;
        }
Пример #2
0
        public override void Update(GameTime gameTime)
        {
            var keyState = Keyboard.GetState();

            if (_oldState.IsKeyDown(Keys.Space) && keyState.IsKeyUp(Keys.Space) || _oldState.IsKeyDown(Keys.Enter) && keyState.IsKeyUp(Keys.Enter))
            {
                NextState = new MainMenuState(game);
                Finished  = true;
            }

            _oldState = keyState;
        }
Пример #3
0
        public override void Update(GameTime gameTime)
        {
            switch (_currentState)
            {
            case InitStateState.FirstRun:

                var task = new Task(Load);
                _currentState = InitStateState.Loading;
                task.Start();
                return;

            case InitStateState.Loading:
                _animationTimeCounter += gameTime.ElapsedGameTime.Milliseconds;

                if (_animationTimeCounter >= 500)
                {
                    _animationText       += ".";
                    _animationTimeCounter = 0f;
                }

                if (_animationText.Length > 3)
                {
                    _animationText = "";
                }

                _pulseTime += (float)gameTime.ElapsedGameTime.TotalSeconds;

                break;

            case InitStateState.Done:

                NextState = new MainMenuState(game);
                Finished  = true;

                break;
            }
        }