Beispiel #1
0
    public void Collision_CompleteMiss()
    {
        Projectile projectile = new BouncingBall(0, new Vector2(0, 0), new Vector2(1, 0));
        Wall       wall       = new Wall(new Vector2(0, 10), new Vector2(0, 5));

        Vector2 collisionPoint = projectile.GetCollisionPoint(wall);

        Assert.AreEqual(Vector2.MinValue, collisionPoint);
    }
Beispiel #2
0
    public void Collision_HeadOn()
    {
        Projectile projectile = new BouncingBall(0, new Vector2(0, 0), new Vector2(1, 0));
        Wall       wall       = new Wall(new Vector2(0, 10), new Vector2(0, -10f));

        Vector2 collisionPoint = projectile.GetCollisionPoint(wall);

        AssertAreClose(new Vector2(0, 0), collisionPoint);
    }
Beispiel #3
0
    public void Collision_OnCorner()
    {
        Projectile projectile = new BouncingBall(0, new Vector2(0, 0), new Vector2(1, 0));
        Wall       wall       = new Wall(new Vector2(-5, 10), new Vector2(4.9f, .1f));

        Vector2 collisionPoint = projectile.GetCollisionPoint(wall);

        AssertAreClose(new Vector2(4.7878675f, 0.21213183f), collisionPoint);
    }