예제 #1
0
        private void Initialise()
        {
            _lag = 0.0;

            _mapManager = new MapManager(_dataManager);
            _mapManager.CreateMap(0);


            _scoreText = new Text(_dataManager.Score.ToString(), _font, _characterSizeScore);
            _scoreText.OutlineColor     = Color.Black;
            _scoreText.OutlineThickness = 1;

            _colliderUpdate = new ColliderUpdate(_dataManager, _mapManager.GetMap(0), _animationManager);
        }
예제 #2
0
        public void Run(int playerCount)
        {
            if (_firstUpdate)
            {
                _firstUpdate = false;

                _mapManager = new MapManager();
                _mapManager.CreateMap(1);


                _colliderUpdate = new ColliderUpdate(_mapManager.GetMap(0), _animationManager);
            }

            if (playerCount != _dataManager.PlayerCount)
            {
                InitialisePlayer(playerCount);
            }



            double elapsedTime = (double)_stopwatch.ElapsedTicks / (double)Stopwatch.Frequency * (1000 - Program.slowMotion);

            _lag += elapsedTime;

            _stopwatch.Restart();

            if (Program.windowState != Program.WindowState.GameOver)
            {
                Input(elapsedTime);
                while (_lag >= MS_PER_UPDATE)
                {
                    Update(MS_PER_UPDATE);
                    _lag -= MS_PER_UPDATE;
                }
            }
            Redraw();

            _stopwatch.Stop();
        }