public void CenterPoint() { GameObject obj = new GameObject() { Position = new Vector2(32f, 32f) }; obj.SetDrawSize(128, 256); //Center point is half of draw size Assert.That(obj.CenterPoint, Is.EqualTo(new Vector2(64f, 128f))); }
public void CenterPoint_NotAffectedByPosition() { GameObject obj = new GameObject() { Position = new Vector2(500f, 500f) }; obj.SetDrawSize(64, 64); //Center point is not affected by position Assert.That(obj.CenterPoint, Is.EqualTo(new Vector2(32f, 32f))); }
public void DrawBounds() { GameObject obj = new GameObject(); obj.SetDrawSize(16, 32); obj.Position = new Vector2(128, 256); BoundingBox box = obj.DrawBounds(); Vector3 expectedMin = new Vector3(obj.AbsolutePosition, 0); Vector3 expectedMax = new Vector3(obj.AbsolutePosition, 0); expectedMax.X += obj.DrawSize.Width; expectedMax.Y += obj.DrawSize.Height; Assert.That(box.Min, Is.EqualTo(expectedMin)); Assert.That(box.Max, Is.EqualTo(expectedMax)); //Rectangle bounds = new Rectangle( obj.DrawBounds.Min; //Assert.That(bounds.Width, Is.EqualTo(16)); //Assert.That(bounds.Height, Is.EqualTo(32)); //Assert.That(bounds.X, Is.EqualTo(128)); //Assert.That(bounds.Y, Is.EqualTo(256)); }
public void SetDrawSize() { GameObject obj = new GameObject(); obj.Position = new Vector2(500f, 500f); obj.SetDrawSize(16, 32); Rectangle size = obj.DrawSize; Assert.That(size.Width, Is.EqualTo(16)); Assert.That(size.Height, Is.EqualTo(32)); Assert.That(size.X, Is.EqualTo(0)); Assert.That(size.Y, Is.EqualTo(0)); }