Game Logic and initialization for Asteroids
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Content ContentData
DeltaEngine.Scenes Scene
Asteroids Game
Namespace: Asteroids
Assembly: Asteroids (in Asteroids.exe) Version: 1.1.1.0 (1.1.1)
Syntax
The Game type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Game | Initializes a new instance of the Game class |
Methods
Name | Description | |
---|---|---|
Add(Entity2D) | (Inherited from Scene.) | |
Add(IEnumerable Entity2D ) | (Inherited from Scene.) | |
AddControlToScene | (Inherited from Scene.) | |
BackToMenu | ||
Clear | (Inherited from Scene.) | |
CreateDefault | (Inherited from ContentData.) | |
Dispose | (Inherited from ContentData.) | |
DisposeData | (Inherited from Scene.) | |
GameOver | ||
GetHighscoresFromString | ||
Hide | (Inherited from Scene.) | |
InternalCreateDefault | (Inherited from ContentData.) | |
LoadData | (Inherited from Scene.) | |
LoadFromFile | (Inherited from Scene.) | |
Remove | (Inherited from Scene.) | |
RestartGame | ||
SetQuadraticBackground(String) | (Inherited from Scene.) | |
SetQuadraticBackground(Material) | (Inherited from Scene.) | |
SetViewportBackground(String) | (Inherited from Scene.) | |
SetViewportBackground(Material) | (Inherited from Scene.) | |
Show | (Inherited from Scene.) | |
StartGame | ||
ToBackground | (Inherited from Scene.) | |
ToForeground | (Inherited from Scene.) | |
ToString | (Inherited from ContentData.) |
Fields
Name | Description | |
---|---|---|
background | (Inherited from Scene.) | |
ContentChanged | (Inherited from ContentData.) | |
GameState |
Properties
Name | Description | |
---|---|---|
AllowCreationIfContentNotFound | (Inherited from ContentData.) | |
Controls | (Inherited from Scene.) | |
DrawArea | (Inherited from Scene.) | |
HudInterface | ||
InteractionLogic | ||
IsDisposed | (Inherited from ContentData.) | |
MetaData | (Inherited from ContentData.) | |
Name | (Inherited from ContentData.) |
Remarks
Examples
[Test, CloseAfterFirstFrame] public void ProjectileAndAsteroidDisposedOnCollision() { var projectile = new Projectile(new Vector2D(0.5f, 0.55f), 0); interactionLogic.CreateAsteroidsAtPosition(Vector2D.Half, 1, 1); AdvanceTimeAndUpdateEntities(); Assert.IsFalse(projectile.IsActive); }
[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 InteractionLogicIsPauseable() { Assert.IsTrue(interactionLogic.IsPauseable); }
See Also