Beispiel #1
0
 /// <summary>
 /// Gets the value of a specific type of child node for a task
 /// </summary>
 /// <returns>The child value. return 0.0 if no node found</returns>
 /// <param name="name">type of child node we want.</param>
 /// <param name="task">Task to get a value for</param>
 /// <param name="bullet">The bullet.</param>
 public float GetChildValue(ENodeName name, BulletMLTask task, Bullet bullet)
 {
     foreach (var tree in ChildNodes)
     {
         if (tree.Name == name)
         {
             return(tree.GetValue(task, bullet));
         }
     }
     return(0.0f);
 }
Beispiel #2
0
        public void CorrectAction()
        {
            string filename = @"Content\FireSpeed.xml";

            pattern.ParseXML(filename);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);
            BulletMLTask myTask = mover.Tasks[0];

            Assert.AreEqual(1, myTask.ChildTasks.Count);
        }
Beispiel #3
0
        public void CorrectAction()
        {
            var filename = new Filename(@"FireSpeed.xml");

            pattern.ParseXML(filename.File);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);
            BulletMLTask myTask = mover.Tasks[0];

            Assert.AreEqual(1, myTask.ChildTasks.Count);
        }
Beispiel #4
0
        public void CorrectAction()
        {
            var filename = TestUtils.GetFilePath(@"Content\FireSpeed.xml");

            TestUtils.Pattern.Parse(filename);
            Mover mover = (Mover)TestUtils.Manager.CreateBullet();

            mover.InitTopNode(TestUtils.Pattern.RootNode);
            BulletMLTask myTask = mover.Tasks[0];

            Assert.AreEqual(1, myTask.ChildTasks.Count);
        }
Beispiel #5
0
        public void FireSpeedInitCorrect1()
        {
            var filename = new Filename(@"FireSpeedBulletSpeed.xml");

            pattern.ParseXML(filename.File);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);
            BulletMLTask myTask   = mover.Tasks[0];
            FireTask     testTask = myTask.ChildTasks[0] as FireTask;

            Assert.AreEqual(5.0f, testTask.FireSpeed);
        }
Beispiel #6
0
        public void BulletSpeedInitCorrect()
        {
            string filename = @"Content\BulletSpeed.xml";

            pattern.ParseXML(filename);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);
            BulletMLTask myTask   = mover.Tasks[0];
            FireTask     testTask = myTask.ChildTasks[0] as FireTask;

            Assert.AreEqual(10.0f, testTask.FireSpeed);
        }
Beispiel #7
0
        public void BulletSpeedInitInitCorrect1()
        {
            string filename = @"Content\BulletSpeed.xml";

            pattern.ParseXML(filename);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);
            BulletMLTask myTask   = mover.Tasks[0];
            FireTask     testTask = myTask.ChildTasks[0] as FireTask;

            Assert.IsTrue(testTask.InitialSpeedTask is SetSpeedTask);
        }
Beispiel #8
0
        public void BulletSpeedInitInitCorrect()
        {
            var filename = new Filename(@"BulletSpeed.xml");

            pattern.ParseXML(filename.File);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);
            BulletMLTask myTask   = mover.Tasks[0];
            FireTask     testTask = myTask.ChildTasks[0] as FireTask;

            Assert.IsNotNull(testTask.InitialSpeedTask);
        }
Beispiel #9
0
        public void BulletSpeedInitCorrect()
        {
            var filename = TestUtils.GetFilePath(@"Content\BulletSpeed.xml");

            TestUtils.Pattern.Parse(filename);
            Mover mover = (Mover)TestUtils.Manager.CreateBullet();

            mover.InitTopNode(TestUtils.Pattern.RootNode);
            BulletMLTask myTask = mover.Tasks[0];

            BulletML.Tasks.FireTask testTask = myTask.ChildTasks[0] as BulletML.Tasks.FireTask;

            Assert.AreEqual(10.0f, testTask.FireSpeed);
        }
Beispiel #10
0
        public void RepeatNumInitCorrect()
        {
            var           filename = TestUtils.GetFilePath(@"Content\ActionRepeatOnce.xml");
            BulletPattern pattern  = new BulletPattern();

            pattern.Parse(filename);
            Mover mover = (Mover)TestUtils.Manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);
            BulletMLTask myTask   = mover.Tasks[0];
            ActionTask   testTask = myTask.ChildTasks[0] as ActionTask;

            Assert.AreEqual(0, testTask.RepeatNum);
        }
Beispiel #11
0
        public void CorrectAction1()
        {
            var           filename = TestUtils.GetFilePath(@"Content\ActionRepeatOnce.xml");
            BulletPattern pattern  = new BulletPattern();

            pattern.Parse(filename);
            Mover mover = (Mover)TestUtils.Manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);
            BulletMLTask myTask = mover.Tasks[0];

            Assert.AreEqual(1, myTask.ChildTasks.Count);
            Assert.IsTrue(myTask.ChildTasks[0] is ActionTask);
        }
Beispiel #12
0
        public void CorrectSpeedRel2()
        {
            string filename = @"Content\AccelRel.xml";

            pattern.ParseXML(filename);
            Mover mover = (Mover)manager.CreateBullet();

            mover.Acceleration = new Vector2(20.0f, 40.0f);
            mover.InitTopNode(pattern.RootNode);

            BulletMLTask myTask = mover.FindTaskByLabelAndName("test", ENodeName.accel);

            Assert.IsNotNull(myTask);
        }
Beispiel #13
0
        public void CorrectSpeedRel2()
        {
            var filename = TestUtils.GetFilePath(@"Content\AccelRel.xml");

            TestUtils.Pattern.Parse(filename);
            Mover mover = (Mover)TestUtils.Manager.CreateBullet();

            mover.Acceleration = new Vector2(20.0f, 40.0f);
            mover.InitTopNode(TestUtils.Pattern.RootNode);

            BulletMLTask myTask = mover.FindTaskByLabelAndName("test", NodeName.accel);

            Assert.IsNotNull(myTask);
        }
Beispiel #14
0
        public void IgnoreSequenceInitSpeed3()
        {
            string filename = @"Content\FireSpeedSequence.xml";

            pattern.ParseXML(filename);
            Mover mover = (Mover)manager.CreateBullet();

            mover.Speed = 100;
            mover.InitTopNode(pattern.RootNode);
            BulletMLTask myTask   = mover.Tasks[0];
            FireTask     testTask = myTask.ChildTasks[0] as FireTask;

            Assert.AreEqual(100.0f, testTask.FireSpeed);
        }
Beispiel #15
0
        public void CorrectParams1()
        {
            var filename = new Filename(@"BulletRefParam.xml");

            pattern.ParseXML(filename.File);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);

            //find the task for the bulletRef
            BulletMLTask bulletRefTask = mover.FindTaskByLabelAndName("test", ENodeName.bullet);

            Assert.AreEqual(1, bulletRefTask.ParamList.Count);
        }
Beispiel #16
0
        public void BulletSpeedTaskValue()
        {
            string filename = @"Content\BulletSpeed.xml";

            pattern.ParseXML(filename);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);
            BulletMLTask myTask    = mover.Tasks[0];
            FireTask     testTask  = myTask.ChildTasks[0] as FireTask;
            SetSpeedTask speedTask = testTask.InitialSpeedTask as SetSpeedTask;

            Assert.IsNotNull(speedTask.Node);
        }
Beispiel #17
0
        public void FireSpeedSeqInitCorrect()
        {
            string        filename = @"Content\FireEmpty.xml";
            BulletPattern pattern  = new BulletPattern();

            pattern.ParseXML(filename);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);
            BulletMLTask myTask   = mover.Tasks[0];
            FireTask     testTask = myTask.ChildTasks[0] as FireTask;

            Assert.IsNull(testTask.SequenceSpeedTask);
        }
Beispiel #18
0
        public void NoSubTasks1()
        {
            var           filename = new Filename(@"FireSpeedBulletSpeed.xml");
            BulletPattern pattern  = new BulletPattern();

            pattern.ParseXML(filename.File);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);
            BulletMLTask myTask   = mover.Tasks[0];
            FireTask     testTask = myTask.ChildTasks[0] as FireTask;

            Assert.AreEqual(1, testTask.ChildTasks.Count);
        }
Beispiel #19
0
        public void CorrectParams()
        {
            string filename = @"Content\BulletRefParam.xml";

            pattern.ParseXML(filename);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);

            //find the task for the bulletRef
            BulletMLTask bulletRefTask = mover.FindTaskByLabel("test");

            Assert.IsNotNull(bulletRefTask);
        }
Beispiel #20
0
        public void FireDirSeqInitCorrect()
        {
            var           filename = new Filename(@"FireEmpty.xml");
            BulletPattern pattern  = new BulletPattern();

            pattern.ParseXML(filename.File);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);
            BulletMLTask myTask   = mover.Tasks[0];
            FireTask     testTask = myTask.ChildTasks[0] as FireTask;

            Assert.IsNull(testTask.SequenceDirectionTask);
        }
Beispiel #21
0
        public void IgnoreSequenceInitSpeed1()
        {
            var filename = new Filename(@"FireSpeedSequence.xml");

            pattern.ParseXML(filename.File);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);
            mover.Speed = 100;
            BulletMLTask myTask   = mover.Tasks[0];
            FireTask     testTask = myTask.ChildTasks[0] as FireTask;

            Assert.AreEqual(ENodeType.sequence, testTask.SequenceSpeedTask.Node.NodeType);
        }
Beispiel #22
0
        public void CorrectAction1()
        {
            string        filename = @"Content\ActionRepeatOnce.xml";
            BulletPattern pattern  = new BulletPattern();

            pattern.ParseXML(filename);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);
            BulletMLTask myTask = mover.Tasks[0];

            Assert.AreEqual(1, myTask.ChildTasks.Count);
            Assert.IsTrue(myTask.ChildTasks[0] is ActionTask);
        }
Beispiel #23
0
        public void RepeatNumInitCorrect()
        {
            string        filename = @"Content\ActionRepeatOnce.xml";
            BulletPattern pattern  = new BulletPattern();

            pattern.ParseXML(filename);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);
            BulletMLTask myTask   = mover.Tasks[0];
            ActionTask   testTask = myTask.ChildTasks[0] as ActionTask;

            Assert.AreEqual(0, testTask.RepeatNum);
        }
Beispiel #24
0
        public void FoundBulletNoSubTasks()
        {
            string        filename = @"Content\BulletSpeed.xml";
            BulletPattern pattern  = new BulletPattern();

            pattern.ParseXML(filename);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);
            BulletMLTask myTask   = mover.Tasks[0];
            FireTask     testTask = myTask.ChildTasks[0] as FireTask;

            Assert.AreEqual(1, testTask.ChildTasks.Count);
        }
Beispiel #25
0
        public void CorrectlyEvalsRand()
        {
            string        filename = @"Content\FireDirectionRand.xml";
            BulletPattern pattern  = new BulletPattern();

            pattern.ParseXML(filename);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);
            BulletMLTask myTask   = mover.Tasks[0];
            FireTask     testTask = myTask.ChildTasks[0] as FireTask;

            Assert.AreEqual(0.1337f, testTask.FireDirection, delta: 0.0001f);
        }
Beispiel #26
0
        public void FireInitialRunInitCorrect()
        {
            string        filename = @"Content\FireEmpty.xml";
            BulletPattern pattern  = new BulletPattern();

            pattern.ParseXML(filename);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);
            BulletMLTask myTask   = mover.Tasks[0];
            FireTask     testTask = myTask.ChildTasks[0] as FireTask;

            Assert.AreEqual(false, testTask.InitialRun);
        }
Beispiel #27
0
        public void CorrectAction2()
        {
            string filename = @"Content\FireSpeed.xml";

            pattern.ParseXML(filename);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);
            BulletMLTask myTask   = mover.Tasks[0];
            FireTask     testTask = myTask.ChildTasks[0] as FireTask;

            Assert.IsNotNull(testTask.Node);
            Assert.IsTrue(testTask.Node.Name == ENodeName.fire);
        }
Beispiel #28
0
        public void BulletSpeedTaskValue1()
        {
            var filename = new Filename(@"BulletSpeed.xml");

            pattern.ParseXML(filename.File);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);
            BulletMLTask myTask    = mover.Tasks[0];
            FireTask     testTask  = myTask.ChildTasks[0] as FireTask;
            SetSpeedTask speedTask = testTask.InitialSpeedTask as SetSpeedTask;

            Assert.IsTrue(speedTask.Node is SpeedNode);
        }
Beispiel #29
0
        public void CorrectParams3()
        {
            string filename = @"Content\BulletRefParam.xml";

            pattern.ParseXML(filename);
            Mover mover = (Mover)manager.CreateBullet();

            mover.InitTopNode(pattern.RootNode);

            //find the task for the bulletRef
            BulletMLTask bulletRefTask = mover.FindTaskByLabelAndName("test", ENodeName.bullet);

            Assert.AreEqual(15.0f, bulletRefTask.ParamList[0]);
        }
Beispiel #30
0
        public void FireSpeedInitInitCorrect1()
        {
            var filename = TestUtils.GetFilePath(@"Content\FireSpeed.xml");

            TestUtils.Pattern.Parse(filename);
            Mover mover = (Mover)TestUtils.Manager.CreateBullet();

            mover.InitTopNode(TestUtils.Pattern.RootNode);
            BulletMLTask myTask = mover.Tasks[0];

            BulletML.Tasks.FireTask testTask = myTask.ChildTasks[0] as BulletML.Tasks.FireTask;

            Assert.IsTrue(testTask.SpeedTask is SpeedTask);
        }