public void VanishTaskTest() { var filename = new Filename(@"Vanish.xml"); pattern.ParseXML(filename.File); Mover mover = (Mover)manager.CreateBullet(); mover.InitTopNode(pattern.RootNode); manager.Update(); Assert.AreEqual(0, manager.movers.Count); }
public void VanishTaskTest() { string filename = @"Content\Vanish.xml"; pattern.ParseXML(filename); Mover mover = (Mover)manager.CreateBullet(); mover.InitTopNode(pattern.RootNode); manager.Update(); Assert.AreEqual(0, manager.movers.Count); }
public void TestTaskCompletionBehaviour() { string filename = @"Content\ActionFireWaitFire.xml"; BulletPattern pattern = new BulletPattern(); pattern.ParseXML(filename); MoverManager manager = new MoverManager(); manager.dude.X = 100; manager.dude.Y = -100; Mover mover = (Mover)manager.CreateBullet(); mover.InitTopNode(pattern.RootNode); Assert.IsFalse(mover.IsCompletedTasks); Assert.AreEqual(1, manager.movers.Count); double factor = Math.Sqrt(2) * 0.5; manager.Update(); // fire, wait 1 Assert.IsFalse(mover.IsCompletedTasks); Assert.AreEqual(2, manager.movers.Count); Mover mover2 = manager.movers[1]; Assert.AreEqual(0, mover.X); Assert.AreEqual(0, mover.Y); Assert.AreEqual(1 * factor, mover2.X, 0.0001f); Assert.AreEqual(-1 * factor, mover2.Y, 0.0001f); manager.Update(); // fire Assert.IsTrue(mover.IsCompletedTasks); Assert.AreEqual(3, manager.movers.Count); Mover mover3 = manager.movers[2]; Assert.AreEqual(0, mover.X); Assert.AreEqual(0, mover.Y); Assert.AreEqual(2 * factor, mover2.X, 0.0001f); Assert.AreEqual(-2 * factor, mover2.Y, 0.0001f); Assert.AreEqual(1 * factor, mover3.X, 0.0001f); Assert.AreEqual(-1 * factor, mover3.Y, 0.0001f); manager.Update(); // just bullet movement Assert.AreEqual(3, manager.movers.Count); Assert.AreEqual(0, mover.X); Assert.AreEqual(0, mover.Y); Assert.AreEqual(3 * factor, mover2.X, 0.0001f); Assert.AreEqual(-3 * factor, mover2.Y, 0.0001f); Assert.AreEqual(2 * factor, mover3.X, 0.0001f); Assert.AreEqual(-2 * factor, mover3.Y, 0.0001f); }
public void CorrectNumberOfBullets1() { dude.pos.X = 100.0f; dude.pos.Y = 0.0f; var filename = new Filename(@"Aim.xml"); pattern.ParseXML(filename.File); Mover mover = (Mover)manager.CreateBullet(); mover.InitTopNode(pattern.RootNode); manager.Update(); Assert.AreEqual(2, manager.movers.Count); }
public void CorrectNumberOfBullets1() { dude.X = 100.0f; dude.Y = 0.0f; string filename = @"Content\Aim.xml"; pattern.ParseXML(filename); Mover mover = (Mover)manager.CreateBullet(); mover.InitTopNode(pattern.RootNode); manager.Update(); Assert.AreEqual(2, manager.movers.Count); }
public void CorrectSpeed1() { string filename = @"Content\RepeatSequence.xml"; pattern.ParseXML(filename); Mover mover = (Mover)manager.CreateBullet(); mover.InitTopNode(pattern.RootNode); for (int i = 0; i < 10; i++) { manager.Update(); } Assert.AreEqual(10, mover.Speed); }
public void CorrectSpeed1() { var filename = new Filename(@"RepeatSequence.xml"); pattern.ParseXML(filename.File); Mover mover = (Mover)manager.CreateBullet(); mover.InitTopNode(pattern.RootNode); for (int i = 0; i < 10; i++) { manager.Update(); } Assert.AreEqual(10, mover.Speed); }
public void CorrectBullets() { var filename = new Filename(@"ActionRefParamChangeSpeed.xml"); pattern.ParseXML(filename.File); Mover mover = (Mover)manager.CreateBullet(); mover.InitTopNode(pattern.RootNode); manager.Update(); Assert.AreEqual(2, manager.movers.Count); mover = manager.movers[1]; Assert.AreEqual("test", mover.Label); }
public void CorrectBullets() { string filename = @"Content\BulletRef.xml"; pattern.ParseXML(filename); Mover mover = (Mover)manager.CreateBullet(); mover.InitTopNode(pattern.RootNode); manager.Update(); Assert.AreEqual(2, manager.movers.Count); mover = manager.movers[1]; Assert.AreEqual("test", mover.Label); }
public void CorrectNumberOfBullets() { var filename = new Filename(@"DoubleRepeat.xml"); pattern.ParseXML(filename.File); Mover mover = (Mover)manager.CreateBullet(); mover.InitTopNode(pattern.RootNode); manager.Update(); //there should be 20 bullets Assert.AreEqual(20, manager.movers.Count); }
public void CorrectNumberOfBullets() { string filename = @"Content\AllRound.xml"; pattern.ParseXML(filename); Mover mover = (Mover)manager.CreateBullet(); mover.InitTopNode(pattern.RootNode); manager.Update(); //there should be 11 bullets Assert.AreEqual(21, manager.movers.Count); }
public void CorrectSpeed1() { var filename = new Filename(@"ChangeSpeed.xml"); pattern.ParseXML(filename.File); Mover mover = (Mover)manager.CreateBullet(); mover.InitTopNode(pattern.RootNode); manager.Update(); Assert.AreEqual(1, mover.Speed); }
public void CorrectSpeed1() { string filename = @"Content\ChangeSpeed.xml"; pattern.ParseXML(filename); Mover mover = (Mover)manager.CreateBullet(); mover.InitTopNode(pattern.RootNode); manager.Update(); Assert.AreEqual(1, mover.Speed); }
public void IgnoreSequenceInitSpeed() { dude.pos.X = 100.0f; dude.pos.Y = 0.0f; var filename = new Filename(@"FireDirectionSequence.xml"); pattern.ParseXML(filename.File); Mover mover = (Mover)manager.CreateBullet(); mover.InitTopNode(pattern.RootNode); manager.Update(); Mover testDude = manager.movers[1]; float direction = testDude.Direction * 180 / (float)Math.PI; Assert.AreEqual(90.0f, direction); }
public void CorrectSpeedAbs1() { string filename = @"Content\AccelAbs.xml"; pattern.ParseXML(filename); Mover mover = (Mover)manager.CreateBullet(); mover.Acceleration = new Vector2(20.0f, 40.0f); mover.InitTopNode(pattern.RootNode); manager.Update(); Assert.AreEqual(19.0f, mover.Acceleration.X); Assert.AreEqual(38.0f, mover.Acceleration.Y); }
public void bulletCreated() { var filename = new Filename(@"FireSpeed.xml"); pattern.ParseXML(filename.File); Mover mover = (Mover)manager.CreateBullet(); mover.InitTopNode(pattern.RootNode); mover.Speed = 100; manager.Update(); Assert.AreEqual(manager.movers.Count, 2); }
public void ChangeDirectionAbs() { var filename = new Filename(@"ChangeDirectionAbs.xml"); pattern.ParseXML(filename.File); dude.pos = new Vector2(0, 100); Mover mover = (Mover)manager.CreateBullet(); mover.InitTopNode(pattern.RootNode); manager.Update(); float direction = mover.Direction * 180 / (float)Math.PI; Assert.AreEqual(45, (int)direction); }
public void ChangeDirectionAbs() { string filename = @"Content\ChangeDirectionAbs.xml"; pattern.ParseXML(filename); dude.X = 0f; dude.Y = 100f; Mover mover = (Mover)manager.CreateBullet(); mover.InitTopNode(pattern.RootNode); manager.Update(); float direction = mover.Direction * 180 / (float)Math.PI; Assert.AreEqual(45, (int)Math.Round(direction)); }
public void bulletCreated() { string filename = @"Content\FireSpeed.xml"; pattern.ParseXML(filename); Mover mover = (Mover)manager.CreateBullet(); mover.InitTopNode(pattern.RootNode); mover.Speed = 100; manager.Update(); Assert.AreEqual(manager.movers.Count, 2); }