Exemple #1
0
        public void FullTile()
        {
            Tile full     = new Tile(1, 0);
            var  expected = new RectangleHitbox(32, 32, new Vector2(0, 0), 0);

            Assert.AreEqual(expected, full.Hitbox[0]);
        }
Exemple #2
0
        public void CircleHitRectangleTest()
        {
            var rect   = new RectangleHitbox(70, 70, new Vector2(100, 137), 20);
            var actual = c.Hit(rect);

            Assert.AreEqual(true, actual);
        }
Exemple #3
0
 public Tile(int x, int y, uint id)
 {
     ID       = id;
     position = new Vector2(x, y);
     hitbox   = new RectangleHitbox(x, y, 120, 120);
     texture  = new TextureComponent();
 }
Exemple #4
0
        public void TestMethod4()
        {
            var  testBox  = new RectangleHitbox(200, 200, new Vector2(150, 100), 0);
            bool expected = true;
            bool actual   = box2.Hit(testBox);

            Assert.AreEqual(expected, actual);
        }
Exemple #5
0
        public void TestMethod1()
        {
            RectangleHitbox testBox = new RectangleHitbox(10, 1000, new Vector2(0, 100), 0);

            bool actual = hb.Hit(testBox);

            bool expected = true;

            Assert.AreEqual(expected, actual);
        }
Exemple #6
0
        public TestSceneHitbox()
        {
            hitbox = new Hitbox(new Rectangle(new Point(50), 0, 100, 213));

            Children = new Drawable[]
            {
                new Box
                {
                    Colour           = new Color4(64, 64, 64, 255),
                    RelativeSizeAxes = Axes.Both
                },
                rectangle = new RectangleHitbox(hitbox)
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre
                },
                new FillFlowContainer
                {
                    FillMode  = FillMode.Fill,
                    Direction = FillDirection.Vertical,
                    Anchor    = Anchor.TopLeft,
                    Origin    = Anchor.TopLeft,
                    Children  = new[]
                    {
                        angle = new SpriteText
                        {
                            Font = new FontUsage(size: 25)
                        },
                        radius = new SpriteText
                        {
                            Font = new FontUsage(size: 25)
                        },
                        mousePosition = new SpriteText
                        {
                            Font = new FontUsage(size: 25)
                        }
                    }
                }
            };

            AddSliderStep("Rotation", 0d, 360d, 0d, v => rectangle.HitboxRotation = v);
        }
Exemple #7
0
 protected abstract bool IntersectingRectangle(RectangleHitbox other);
Exemple #8
0
 public Actor(int x, int y, int width, int height)
 {
     position = new Vector2(x, y);
     hitbox   = new RectangleHitbox(x, y, width, height);
 }
 protected override bool IntersectingRectangle(RectangleHitbox other)
 {
     throw new System.NotImplementedException();
 }