public override void Update(GameTime gameTime) { if (GameOverMsg.Accepted || Keyboard.GetState().IsKeyDown(Keys.Escape)) { _mainGame._nextGameState = _mainGame.Menu; Restart(); } if (_gameInfo.GameTime <= 0) { _gameOver = true; GameOverMsg.Update(); return; } if (_timer >= 1f) { _gameInfo.GameTime -= (int)_timer; _timer = 0; } _previousState = _currentState; _currentState = Mouse.GetState().LeftButton; spriteSpawner.SpawnAll(_sprites); _timer += (float)gameTime.ElapsedGameTime.TotalSeconds; _collisionTimer += (float)gameTime.ElapsedGameTime.TotalSeconds; _omegalulTimer += (float)gameTime.ElapsedGameTime.TotalSeconds; Sprite anyDesters = _sprites.Where(sp => sp is Destroyer).FirstOrDefault(); if (anyDesters == null && _explosions.Count == 0) { FreezeField = false; } //Основной метод update для планет (гравитация) foreach (var pl in _sprites.ToArray()) { pl.Update(gameTime, _sprites); } foreach (var rect in bombRectangles) { rect.Update(gameTime, _sprites); } foreach (Animation exp in _explosions) { exp.Update(gameTime); } if (!CheckRespawned(_sprites) && _omegalulTimer > 1f) { gameGrid.FillCheckMatrix(_sprites); var res = gameGrid.IsThereAMatch(); if (res == false) { FieldHasNoMatches = true; } _omegalulTimer = 0; } if (FieldHasNoMatches) { foreach (var sp in _sprites) { if (sp.GetType() != typeof(Destroyer)) { sp.FishForClick(); } } SwapClickWorks(); } if (FieldHasNoMatches == false && _collisionTimer > 1f && !CheckRespawned(_sprites)) { foreach (var pl in _sprites.ToArray()) { //pl.MatchDetectionOLD(gameTime, _sprites); pl.MatchDetection(gameTime, _sprites); } _collisionTimer = 0; } }