public void TestBoundingBox() { var actor = new MockActor(Vector3D.One, 1.0f); var box = new BoundingBox(new Vector3D(0.5f, 0.5f, 0.5f), new Vector3D(1.5f, 1.5f, 1.5f)); Assert.AreEqual(box, actor.GetBoundingBox()); }
public void CheckChangeScaleFactor() { var actor = new MockActor(Vector3D.One, 1.0f); actor.ScaleFactor = 2; Assert.AreEqual(2, actor.ScaleFactor); }
public void CheckChangeRotationZ() { var actor = new MockActor(Vector3D.One, 1.0f); actor.OrientationChanged += () => { CheckRotationZHasChanged(actor); }; actor.RotationZ = 90.0f; }
public void TestIfTwoActorsAreCollidingIn3D() { var actor1 = new MockActor(Vector3D.One, 1.0f); var actor2 = new MockActor(Vector3D.Zero, 0.0f); Assert.IsTrue(actor1.IsColliding(actor2)); }
public void CheckChangePosition() { var actor = new MockActor(Vector3D.One, 1.0f); actor.PositionChanged += () => { CheckPositionHasChanged(actor); }; actor.Position = new Vector3D(2, 2, 2); }
public void CheckChangeScale() { var actor = new MockActor(Vector3D.One, 1.0f); actor.ScaleChanged += () => { CheckScaleHasChanged(actor); }; actor.Scale = new Vector3D(2, 2, 2); }
public void TestActorSpawnDespawnNotChangeAnything() { var actor = new MockActor(Vector3D.One, 1.0f); actor.RenderModel(); Assert.IsFalse(actor.Is2D()); Assert.AreEqual(Vector3D.One, actor.Position); }
public void TestBoundingSphere() { var actor = new MockActor(Vector3D.One, 1.0f); var sphere = new BoundingSphere(Vector3D.One, 1.0f); Assert.AreEqual(sphere, actor.GetBoundingSphere()); }
public void CreateProjectileAndAddMissile() { projectileOwner = new MockActor(Vector3D.Zero, 0); projectileTarget = new MockActor(Vector3D.Zero, 0); var missile = new MockMissile(); projectile = new Projectile(projectileOwner, projectileTarget, missile); Assert.AreEqual(missile, projectile.GetFirstChildOfType<MockMissile>()); }
public void CreateProjectileAndAddMissile() { projectileOwner = new MockActor(Vector3D.Zero, 0); projectileTarget = new MockActor(Vector3D.Zero, 0); var missile = new MockMissile(); projectile = new Projectile(projectileOwner, projectileTarget, missile); Assert.AreEqual(missile, projectile.GetFirstChildOfType <MockMissile>()); }
public void TestTimeTrigger() { var actor = new MockActor(Vector3D.Zero, 0.0f); var data = new TimeTrigger.Data(Color.Red, Color.Green, 1.0f); actor.Add(data); actor.Start<TimeTrigger>(); actor.Add(Color.Black); Assert.AreEqual(Color.Black, actor.Get<Color>()); Assert.AreEqual(Color.Red, data.FirstColor); Assert.AreEqual(Color.Green, data.SecondColor); Assert.AreEqual(1.0f, data.Interval); AdvanceTimeAndUpdateEntities(1.1f); Assert.AreEqual(Color.Red, actor.Get<Color>()); }
public void TestTimeTrigger() { var actor = new MockActor(Vector3D.Zero, 0.0f); var data = new TimeTrigger.Data(Color.Red, Color.Green, 1.0f); actor.Add(data); actor.Start <TimeTrigger>(); actor.Add(Color.Black); Assert.AreEqual(Color.Black, actor.Get <Color>()); Assert.AreEqual(Color.Red, data.FirstColor); Assert.AreEqual(Color.Green, data.SecondColor); Assert.AreEqual(1.0f, data.Interval); AdvanceTimeAndUpdateEntities(1.1f); Assert.AreEqual(Color.Red, actor.Get <Color>()); }
public void TestIfTwoActorsAreCollidingIn2D() { var actor1 = new MockActor(Vector2D.One, 0.0f, Vector2D.One); var actor2 = new MockActor(Vector2D.Zero, 0.0f, Vector2D.One); Assert.IsTrue(actor1.IsColliding(actor2)); }
private static void CheckPositionHasChanged(MockActor actor) { Assert.AreEqual(new Vector3D(2, 2, 2), actor.Position); }
public void TestDrawArea() { var actor = new MockActor(Vector3D.One, 1.0f); Assert.AreEqual(new Rectangle(0.5f, 0.5f, 1, 1), actor.GetDrawArea()); }
private static void CheckRotationZHasChanged(MockActor actor) { Assert.AreEqual(90.0f, actor.RotationZ); }
private static void CheckScaleHasChanged(MockActor actor) { Assert.AreEqual(new Vector3D(2, 2, 2), actor.Scale); }