Пример #1
0
        public void Reset()
        {
            _difficulty = 0;
            ResultScene rs = Scenes[3] as ResultScene;

            rs.TotalScore = 0;
            rs.Round      = 0;
        }
Пример #2
0
        public override void Update(GameTime gameTime)
        {
            if (_score.PeopleKilled < _building.Persons.Count())
            {
                _timer -= gameTime.ElapsedGameTime;
            }

            _building.Update(gameTime);
            _score.Update(gameTime);

            if (_timer <= TimeSpan.Zero)
            {
                GameOverScene go = ((GameOverScene)Handler.Scenes[(int)SceneNames.GameOverScene]);
                go.RefreshScore(_currentDifficulty);
                Handler.SwitchToScene((int)SceneNames.GameOverScene);
            }
            else if (_score.PeopleKilled >= _building.Persons.Count())
            {
                _delayTimer += gameTime.ElapsedGameTime;

                if (_delayTimer > new TimeSpan(0, 0, 3))
                {
                    ResultScene resultScene = (ResultScene)Handler.Scenes[(int)SceneNames.ResultScene];
                    resultScene.RefreshScore(_score, _timer, _currentDifficulty);
                    Handler.SwitchToScene((int)SceneNames.ResultScene);
                }
            }

            LinkedList <Cloud> _disposeList = new LinkedList <Cloud>();

            //clouds
            foreach (Cloud cloud in _clouds)
            {
                cloud.Update(gameTime);
                if (cloud.Dispose)
                {
                    _disposeList.AddLast(cloud);
                }
            }

            foreach (Cloud cloud in _disposeList)
            {
                _clouds.Remove(cloud);
            }


            _currentCloudTimer += gameTime.ElapsedGameTime;
            if (_currentCloudTimer > _cloudSpawnTimer)
            {
                Cloud cloud = new Cloud(Game);
                _clouds.Add(cloud);
                _cloudSpawnTimer   = new TimeSpan(0, 0, RandomHelper.RandomInt(30, 60));
                _currentCloudTimer = TimeSpan.Zero;
            }
        }
Пример #3
0
        public SceneHandler(Game game)
        {
            _game     = game;
            Scenes    = new Scene[10];
            Scenes[0] = new TitleScene(_game, this);
            Scenes[2] = new GameOverScene(_game, this);
            Scenes[3] = new ResultScene(_game, this);
            Scenes[4] = new InstructionScene(_game, this);

            _activeScene = Scenes[(int)SceneNames.TitleScene];
        }