Namespace: DeltaEngine.Rendering2D
Assembly: DeltaEngine.Rendering2D (in DeltaEngine.Rendering2D.dll) Version: 1.1.1.0 (1.1.1)
Tests: Snake.Tests.SnakeGameTests
2 unit tests call DeltaEngine.Rendering2D.Entity2D.DrawArea
Assembly: DeltaEngine.Rendering2D (in DeltaEngine.Rendering2D.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Property Value
Type: RectangleRemarks
Examples
[Test, CloseAfterFirstFrame] public void RespawnChunkIfCollidingWithSnake() { var game = new Game(Resolve<Window>()); game.StartGame(); game.Chunk.DrawArea = game.Snake.Get<Body>().BodyParts[0].DrawArea; Assert.IsTrue(game.Chunk.IsCollidingWithSnake(game.Snake.Get<Body>().BodyParts)); game.RespawnChunk(); Assert.IsFalse(game.Chunk.IsCollidingWithSnake(game.Snake.Get<Body>().BodyParts)); }
[Test, CloseAfterFirstFrame] public void SnakeEatsChunk() { var game = new Game(Resolve<Window>()); game.StartGame(); var snakeHead = game.Snake.Get<Body>().BodyParts[0].DrawArea; var direction = game.Snake.Get<Body>().Direction; var originalLength = game.Snake.Get<Body>().BodyParts.Count; game.Chunk.DrawArea = new Rectangle(new Vector2D(snakeHead.Left + direction.X, snakeHead.Top + direction.Y), new Size(blockSize)); game.MoveUp(); AdvanceTimeAndUpdateEntities(moveSpeed); Assert.AreEqual(originalLength + 1, game.Snake.Get<Body>().BodyParts.Count); }
See Also