public void Brick_BeingDestroyedByBall() { // Create brick and systems. BrickSystem system = CreateBrickSystem(); Brick brick = CreateBrick(system.World, "Test_2_Brick_1"); // Add ball collision to Brick collider. system.World.GetSystem <ColliderSystem>().Get(brick.Parent).Colliding = true; system.World.GetSystem <ColliderSystem>().Get(brick.Parent).CollidingWith.Add("Ball"); // 'Hit' brick with the ball 3 times. system.Update(0.5f); system.Update(0.5f); system.Update(0.5f); // Check health is 0 and parent entity is set to be destroyed. Assert.AreEqual(brick.Health, 0, 0.001, "Brick not being destroyed by ball."); Assert.AreEqual(brick.Parent.Destroy, true, "Brick entity not being destroyed by ball."); }
public void Brick_BeingHitByBall() { // Create brick and systems. BrickSystem system = CreateBrickSystem(); Brick brick = CreateBrick(system.World, "Test_1_Brick_1"); // Add ball collision to Brick collider. system.World.GetSystem <ColliderSystem>().Get(brick.Parent).Colliding = true; system.World.GetSystem <ColliderSystem>().Get(brick.Parent).CollidingWith.Add("Ball"); // Process collision. system.Update(0.5f); // Check new health. Assert.AreEqual(brick.Health, 2, 0.001, "Brick not being hit by ball."); }