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

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

            actor.OrientationChanged += () => { CheckRotationZHasChanged(actor); };
            actor.RotationZ           = 90.0f;
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 5
0
        public void CheckChangePosition()
        {
            var actor = new MockActor(Vector3D.One, 1.0f);

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

            actor.ScaleChanged += () => { CheckScaleHasChanged(actor); };
            actor.Scale         = new Vector3D(2, 2, 2);
        }
Ejemplo n.º 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);
		}
Ejemplo n.º 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());
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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>());
		}
Ejemplo n.º 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>());
        }
Ejemplo n.º 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>());
		}
Ejemplo n.º 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>());
        }
Ejemplo n.º 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));
		}
Ejemplo n.º 15
0
 private static void CheckPositionHasChanged(MockActor actor)
 {
     Assert.AreEqual(new Vector3D(2, 2, 2), actor.Position);
 }
Ejemplo n.º 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());
		}
Ejemplo n.º 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());
		}
Ejemplo n.º 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());
		}
Ejemplo n.º 19
0
		public void CheckChangeScaleFactor()
		{
			var actor = new MockActor(Vector3D.One, 1.0f);
			actor.ScaleFactor = 2;
			Assert.AreEqual(2, actor.ScaleFactor);
		}
Ejemplo n.º 20
0
 private static void CheckRotationZHasChanged(MockActor actor)
 {
     Assert.AreEqual(90.0f, actor.RotationZ);
 }
Ejemplo n.º 21
0
		public void CheckChangeRotationZ()
		{
			var actor = new MockActor(Vector3D.One, 1.0f);
			actor.OrientationChanged += () => { CheckRotationZHasChanged(actor); };
			actor.RotationZ = 90.0f;
		}
Ejemplo n.º 22
0
		private static void CheckScaleHasChanged(MockActor actor)
		{
			Assert.AreEqual(new Vector3D(2, 2, 2), actor.Scale);
		}
Ejemplo n.º 23
0
		public void CheckChangeScale()
		{
			var actor = new MockActor(Vector3D.One, 1.0f);
			actor.ScaleChanged += () => { CheckScaleHasChanged(actor); };
			actor.Scale = new Vector3D(2, 2, 2);
		}
Ejemplo n.º 24
0
		private static void CheckPositionHasChanged(MockActor actor)
		{
			Assert.AreEqual(new Vector3D(2, 2, 2), actor.Position);
		}
Ejemplo n.º 25
0
 private static void CheckScaleHasChanged(MockActor actor)
 {
     Assert.AreEqual(new Vector3D(2, 2, 2), actor.Scale);
 }
Ejemplo n.º 26
0
		private static void CheckRotationZHasChanged(MockActor actor)
		{
			Assert.AreEqual(90.0f, actor.RotationZ);
		}
Ejemplo n.º 27
0
		public void CheckChangePosition()
		{
			var actor = new MockActor(Vector3D.One, 1.0f);
			actor.PositionChanged += () => { CheckPositionHasChanged(actor); };
			actor.Position = new Vector3D(2, 2, 2);
		}
Ejemplo n.º 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());
        }