Beispiel #1
0
        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());
        }
Beispiel #2
0
        public void CheckChangeScaleFactor()
        {
            var actor = new MockActor(Vector3D.One, 1.0f);

            actor.ScaleFactor = 2;
            Assert.AreEqual(2, actor.ScaleFactor);
        }
Beispiel #3
0
        public void CheckChangeRotationZ()
        {
            var actor = new MockActor(Vector3D.One, 1.0f);

            actor.OrientationChanged += () => { CheckRotationZHasChanged(actor); };
            actor.RotationZ           = 90.0f;
        }
Beispiel #4
0
        public void TestIfTwoActorsAreCollidingIn3D()
        {
            var actor1 = new MockActor(Vector3D.One, 1.0f);
            var actor2 = new MockActor(Vector3D.Zero, 0.0f);

            Assert.IsTrue(actor1.IsColliding(actor2));
        }
Beispiel #5
0
        public void CheckChangePosition()
        {
            var actor = new MockActor(Vector3D.One, 1.0f);

            actor.PositionChanged += () => { CheckPositionHasChanged(actor); };
            actor.Position         = new Vector3D(2, 2, 2);
        }
Beispiel #6
0
        public void CheckChangeScale()
        {
            var actor = new MockActor(Vector3D.One, 1.0f);

            actor.ScaleChanged += () => { CheckScaleHasChanged(actor); };
            actor.Scale         = new Vector3D(2, 2, 2);
        }
Beispiel #7
0
		public void TestActorSpawnDespawnNotChangeAnything()
		{
			var actor = new MockActor(Vector3D.One, 1.0f);
			actor.RenderModel();
			Assert.IsFalse(actor.Is2D());
			Assert.AreEqual(Vector3D.One, actor.Position);
		}
Beispiel #8
0
        public void TestBoundingSphere()
        {
            var actor  = new MockActor(Vector3D.One, 1.0f);
            var sphere = new BoundingSphere(Vector3D.One, 1.0f);

            Assert.AreEqual(sphere, actor.GetBoundingSphere());
        }
Beispiel #9
0
        public void TestActorSpawnDespawnNotChangeAnything()
        {
            var actor = new MockActor(Vector3D.One, 1.0f);

            actor.RenderModel();
            Assert.IsFalse(actor.Is2D());
            Assert.AreEqual(Vector3D.One, actor.Position);
        }
Beispiel #10
0
		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>());
		}
Beispiel #11
0
        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>());
        }
Beispiel #12
0
		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>());
		}
Beispiel #13
0
        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>());
        }
Beispiel #14
0
		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));
		}
Beispiel #15
0
 private static void CheckPositionHasChanged(MockActor actor)
 {
     Assert.AreEqual(new Vector3D(2, 2, 2), actor.Position);
 }
Beispiel #16
0
		public void TestBoundingSphere()
		{
			var actor = new MockActor(Vector3D.One, 1.0f);
			var sphere = new BoundingSphere(Vector3D.One, 1.0f);
			Assert.AreEqual(sphere, actor.GetBoundingSphere());
		}
Beispiel #17
0
		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());
		}
Beispiel #18
0
		public void TestDrawArea()
		{
			var actor = new MockActor(Vector3D.One, 1.0f);
			Assert.AreEqual(new Rectangle(0.5f, 0.5f, 1, 1), actor.GetDrawArea());
		}
Beispiel #19
0
		public void CheckChangeScaleFactor()
		{
			var actor = new MockActor(Vector3D.One, 1.0f);
			actor.ScaleFactor = 2;
			Assert.AreEqual(2, actor.ScaleFactor);
		}
Beispiel #20
0
 private static void CheckRotationZHasChanged(MockActor actor)
 {
     Assert.AreEqual(90.0f, actor.RotationZ);
 }
Beispiel #21
0
		public void CheckChangeRotationZ()
		{
			var actor = new MockActor(Vector3D.One, 1.0f);
			actor.OrientationChanged += () => { CheckRotationZHasChanged(actor); };
			actor.RotationZ = 90.0f;
		}
Beispiel #22
0
		private static void CheckScaleHasChanged(MockActor actor)
		{
			Assert.AreEqual(new Vector3D(2, 2, 2), actor.Scale);
		}
Beispiel #23
0
		public void CheckChangeScale()
		{
			var actor = new MockActor(Vector3D.One, 1.0f);
			actor.ScaleChanged += () => { CheckScaleHasChanged(actor); };
			actor.Scale = new Vector3D(2, 2, 2);
		}
Beispiel #24
0
		private static void CheckPositionHasChanged(MockActor actor)
		{
			Assert.AreEqual(new Vector3D(2, 2, 2), actor.Position);
		}
Beispiel #25
0
 private static void CheckScaleHasChanged(MockActor actor)
 {
     Assert.AreEqual(new Vector3D(2, 2, 2), actor.Scale);
 }
Beispiel #26
0
		private static void CheckRotationZHasChanged(MockActor actor)
		{
			Assert.AreEqual(90.0f, actor.RotationZ);
		}
Beispiel #27
0
		public void CheckChangePosition()
		{
			var actor = new MockActor(Vector3D.One, 1.0f);
			actor.PositionChanged += () => { CheckPositionHasChanged(actor); };
			actor.Position = new Vector3D(2, 2, 2);
		}
Beispiel #28
0
        public void TestDrawArea()
        {
            var actor = new MockActor(Vector3D.One, 1.0f);

            Assert.AreEqual(new Rectangle(0.5f, 0.5f, 1, 1), actor.GetDrawArea());
        }