}         // ResetLifeValues()

        #endregion

        #region Handle game logic
        /// <summary>
        /// Handle game logic
        /// </summary>
        /// <param name="asteroidManager">Asteroid manager</param>
        public static void HandleGameLogic(GameAsteroidManager asteroidManager)
        {
            if (gameTimeMs == 0)
            {
                // Start playing rocket motor
                Sound.PlayRocketMotorSound(0.86f);
                //obs: asteroidManager.PlayRocketMotorSound(0.86f);
            }             // if (gameTimeMs)

            // Increase explosion effect timeout if used
            if (explosionTimeoutMs >= 0)
            {
                explosionTimeoutMs -= BaseGame.ElapsedTimeThisFrameInMs;
                if (explosionTimeoutMs < 0)
                {
                    explosionTimeoutMs = 0;
                }
            }             // if (explosionTimeoutMs)
            else if (GameOver == false)
            {
                // Increase game time
                gameTimeMs += BaseGame.ElapsedTimeThisFrameInMs;

                // Same for rocket life time
                lifeTimeMs += BaseGame.ElapsedTimeThisFrameInMs;
            }             // else if

            if (explosionTimeoutMs2 >= 0)
            {
                explosionTimeoutMs2 -= BaseGame.ElapsedTimeThisFrameInMs;
                if (explosionTimeoutMs2 < 0)
                {
                    explosionTimeoutMs2 = 0;
                }
            }             // if (explosionTimeoutMs2)
            if (explosionTimeoutMs3 >= 0)
            {
                explosionTimeoutMs3 -= BaseGame.ElapsedTimeThisFrameInMs;
                if (explosionTimeoutMs3 < 0)
                {
                    explosionTimeoutMs3 = 0;
                }
            }             // if (explosionTimeoutMs3)

            if (cameraWobbelTimeoutMs > 0)
            {
                cameraWobbelTimeoutMs -= BaseGame.ElapsedTimeThisFrameInMs;
                if (cameraWobbelTimeoutMs < 0)
                {
                    cameraWobbelTimeoutMs = 0;
                }
            }             // if (cameraWobbelTimeoutMs)

            // Don't handle any more game logic if game is over.
            if (Player.GameOver)
            {
                return;
            }

            float oldHealth = Player.health;

            // Adjust rocket playback frequency to flying speed
            Sound.ChangeRocketMotorPitchEffect(
                -0.24f + speed * 0.6f);
            //0.66f + speed * 0.9f);

            // Check if too near to an asteroid. Check 3x3 sector in middle.
            if (CanControlRocket)
            {
                float playerCollision = asteroidManager.PlayerAsteroidCollision();

                if (playerCollision > 0.0f)
                {
                    // Frontal hits might kill us, side hits only hurt
                    // (but always at least 10%).
                    Player.health -= 0.1f + playerCollision * 4.25f;

                    // We shouldn't die on the first hit, even a frontal hit
                    // could be survived IF (and only if) we were at 100% health!
                    if (oldHealth == 1.0f &&
                        Player.health <= 0.0f)
                    {
                        // Restore to 10% (next hit will kill us!)
                        Player.health = 0.1f;
                    }     // if (oldHealth)
                }         // if (playerCollision)
            }             // if (CanControlRocket)

            // If we are below 0 fuel, that gonna hurt.
            if (Player.fuel < 0)
            {
                Player.fuel    = 0;
                Player.health -= BaseGame.MoveFactorPerSecond /
                                 Player.HurtFactorIfFuelIsEmpty;
            }             // if (Player.fuel)

            // Show health low warning if health is getting very low.
            if (oldHealth >= 0.25f && health < 0.25f ||
                oldHealth >= 0.1f && health < 0.1f)
            {
                showHealthWarningTimeoutMs = 8 * 1000;
            }
            if (showHealthWarningTimeoutMs > 0)
            {
                showHealthWarningTimeoutMs -= BaseGame.ElapsedTimeThisFrameInMs;
                if (showHealthWarningTimeoutMs < 0)
                {
                    showHealthWarningTimeoutMs = 0;
                }
            }             // if (showHealthWarningTimeoutMs)

            // Die if health is 0 or lower
            if (Player.health <= 0)
            {
                Player.health = 0;

                // Explode!
                Player.explosionTimeoutMs = MaxExplosionTimeoutMs;

                // Reset everything for the player, all items and stuff
                Player.ResetLifeValues();

                // If we have lifes left, reduce them.
                if (Player.lifes > 0)
                {
                    Sound.PlayExplosionSound();
                    Player.lifes--;
                }                 // if (Player.lifes)
                else
                {
                    victory = false;
                    // Play multiple explosions (a little later)
                    Player.explosionTimeoutMs2 = (int)(MaxExplosionTimeoutMs * 1.6f);
                    Player.explosionTimeoutMs3 = (int)(MaxExplosionTimeoutMs * 2.1f);
                    Player.SetGameOverAndUploadHighscore();
                    Sound.StopRocketMotorSound();
                    Sound.PlayDefeatSound();
                }                 // else

                // Use minimum possible speed
                Player.Speed = Player.MinSpeedWithoutItem;

                // Kill all asteroids in inner sectors (3x3)
                asteroidManager.KillAllInnerSectorAsteroids();
            }             // if (Player.health)

            // Reached target? Then we won!
            if (BaseGame.CameraPos.Z >=
                asteroidManager.CurrentLevel.Length * GameAsteroidManager.SectorDepth)
            {
                victory = true;

                // Add number of lifes left to score (10000 points per life)
                score += lifes * 10000;

                // If player took less than levelLength/2 seconds, add time bonus
                int maxGameTime = (asteroidManager.CurrentLevel.Length / 2) * 1000;
                if (gameTimeMs < maxGameTime)
                {
                    // Give 200 points per second, 12000 points per minute
                    // E.g. if we took only 4 minutes we get 4 * 12000 extra points =
                    // 48000 extra points.
                    score += (int)(maxGameTime - gameTimeMs) / 10;
                }

                // And add health and fuel we left to score
                score += (int)(health * 3000);
                score += (int)(fuel * 4000);

                // End game, upload highscore and stuff!
                Player.SetGameOverAndUploadHighscore();
                Sound.StopRocketMotorSound();
                Sound.PlayVictorySound();
            }     // if (BaseGame.CameraPos.Z)
        }         // HandleGameLogic(asteroidManager)