Game GameOver Method Delta Engine Documentation

Namespace: Asteroids
Assembly: Asteroids (in Asteroids.exe) Version: 1.1.1.0 (1.1.1)
Syntax

public void GameOver()
Remarks

Tests: Asteroids.Tests.GameLogicTests
Examples

2 unit tests call Asteroids.Game.GameOver
[Test, CloseAfterFirstFrame]
public void PlayerShipAndAsteroidCollidingResultsInGameOver()
{
    bool gameOver = false;
    interactionLogic.BeginGame();
    interactionLogic.GameOver += () => { gameOver = true; };
    interactionLogic.Player.Set(new Rectangle(Vector2D.Half, new Size(.05f)));
    interactionLogic.CreateAsteroidsAtPosition(Vector2D.Half, 1, 1);
    AdvanceTimeAndUpdateEntities();
    Assert.IsTrue(gameOver);
}
[Test, CloseAfterFirstFrame]
public void GameOverResultsInSameStateEvenMultipleCalls()
{
    CreateAndStartGame();
    game.GameOver();
    game.GameOver();
    Assert.AreEqual(GameState.GameOver, game.GameState);
    Assert.IsFalse(game.InteractionLogic.Player.IsActive);
}
See Also