public Monster(IViewFactory i_Factory, string i_AssetName) : base(i_Factory, i_AssetName) { r_Bullet = new Bullet(ViewFactory, eSpriteType.Bomb); r_Bullet.YVelocity = 200; r_Random = new Random(GetHashCode()); Type = eSpriteType.Monster; }
public void testShouldMoveAccordingToYVelocity() { Bullet bullet = new Bullet(new MockViewFactory(100, 100, 10, 10)); bullet.Position = new Vector2(50, 50); bullet.YVelocity = -10; bullet.Update(gameTimeWithOneSecond()); Assert.AreEqual(new Vector2(50, 40), bullet.Position); }
public void testShouldKillItselfWhenReachingTheEdgeOfTheView() { Bullet bullet = new Bullet(new MockViewFactory(100, 100, 10, 10)); bullet.Position = new Vector2(50, 10); bullet.YVelocity = -10; bullet.Alive = true; bullet.Update(gameTimeWithOneSecond()); Assert.AreEqual(false, bullet.Alive); }
private Bullet createBullet() { Bullet bullet = new Bullet(ViewFactory, eSpriteType.Bullet); bullet.BulletHit += Ship_BulletHit; bullet.YVelocity = k_BulletVelocity; return bullet; }