public override void UpdateGameObjects() { //LogToDebugOutput($"{1f/_gameEngineInterface.Time.DeltaTime}fps"); if (ShouldPlayShipSound) { _audioSourceShip.PlayOneShot(); } UpdateAsteroidRotation(); UpdateShipRotation(); UpdateShipPosition(); if (_playerShipScript.Health <= 0) { _dataLayer.DecrementNumLivesRemaining(1); _logicHandler.SetSceneState((int)GameState.LoseTransition); } else { //if the last asteroid flies off the screen, you win var screenCoordsAsteroid = _gameEngineInterface.ScreenUtils.GetScreenPointFromWorldPoint(_lastAsteroid.Transform.Position); if (screenCoordsAsteroid.Y < -20.0f) // checking for < 0 is just when the center of the asteroid is off screen. todo real game: make a new constant ASTEROID_HEIGHT that you can use to tell if the asteroid is completely off-screen { CalculateScore(); _logicHandler.GameController.ProgressToNextLevel(); _logicHandler.SetSceneState((int)GameState.WinTransition); } } }