コード例 #1
0
        public void shouldDieWhenRocketHitLevel()
        {
            var stubPhysicsComponent = MockRepository.GenerateStub<IPhysicsComponent>();
            Rocket rocket = new Rocket(Vector2.Zero, Vector2.Zero, stubPhysicsComponent);
            Assert.IsTrue(rocket.IsAlive);

            stubPhysicsComponent.Raise(me => me.CollidedWithWorld += null);

            Assert.IsFalse(rocket.IsAlive);
        }
コード例 #2
0
        public void ShouldRemoveDeadRocketsFromList()
        {
            var aliveRocket = new Rocket(Vector2.Zero, Vector2.Zero, MockRepository.GenerateStub<IPhysicsComponent>()) { IsAlive = true };
            var deadRocket = new Rocket(Vector2.Zero, Vector2.Zero, MockRepository.GenerateStub<IPhysicsComponent>()) { IsAlive = false };
            rocketLauncher.Rockets.AddRange(new System.Collections.Generic.List<Rocket>() { aliveRocket, deadRocket });

            rocketLauncher.RemoveDeadProjectiles();

            Assert.Contains(aliveRocket, rocketLauncher.Rockets);
            Assert.AreEqual(1, rocketLauncher.Rockets.Count);
        }
コード例 #3
0
ファイル: RocketLauncher.cs プロジェクト: zakvdm/Frenetic
 public RocketLauncher(Rocket.Factory rocketFactory)
 {
     this.RocketFactory = rocketFactory;
     this.Rockets = new List<Rocket>();
 }