Ejemplo n.º 1
0
        public void TestCollision()
        {
            Item medKit = new MedKit();
            medKit.Position = new Vector2(4.2f, 0);

            player.Move(Direction.Right, 2f);
            player.UpdatePosition();
            player.Move(Direction.Right, 2f);
            player.UpdatePosition();

            player.CollisionBox = new Rectangle((int)player._Position.X, (int)player._Position.Y, 1, 1);
            medKit.CollisionBox = new Rectangle((int)medKit.Position.X, (int)medKit.Position.Y, 1, 1);

            Assert.IsTrue(medKit.CollisionBox.Intersects(player.CollisionBox));
        }
Ejemplo n.º 2
0
        public void TestSpriteRemoving()
        {
            Item medKit1, medKit2, weapon1;
            medKit1 = new MedKit();
            medKit2 = new MedKit();
            weapon1 = new ShootableWeapon();

            layer.addSprite(medKit1);
            layer.addSprite(medKit2);
            layer.addSprite(weapon1);

            layer.Sprites.Remove(medKit2);

            Assert.AreSame((int)layer.Sprites.Count, 2);
        }