/// <summary> /// Initializes a new instance of the <see cref="FireTask"/> class. /// </summary> /// <param name="node">Node.</param> /// <param name="owner">Owner.</param> public FireTask(FireNode node, BulletMLTask owner) : base(node, owner) { Debug.Assert(null != Node); Debug.Assert(null != Owner); NumTimesInitialized = 0; }
public void GotActionRefNode1() { string filename = @"Content\ActionRefEmpty.xml"; BulletPattern pattern = new BulletPattern(); pattern.ParseXML(filename); ActionNode testActionNode = pattern.RootNode.GetChild(ENodeName.action) as ActionNode; FireNode testFireNode = testActionNode.GetChild(ENodeName.fire) as FireNode; Assert.IsNotNull(testFireNode); }
public void GotBulletNode() { var filename = new Filename(@"FireEmpty.xml"); BulletPattern pattern = new BulletPattern(); pattern.ParseXML(filename.File); ActionNode testActionNode = pattern.RootNode.GetChild(ENodeName.action) as ActionNode; FireNode testFireNode = testActionNode.GetChild(ENodeName.fire) as FireNode; Assert.IsNotNull(testFireNode.BulletDescriptionNode); }
public void CreatedSpeedNode2() { string filename = @"Content\FireSpeed.xml"; BulletPattern pattern = new BulletPattern(); pattern.ParseXML(filename); ActionNode testActionNode = pattern.RootNode.GetChild(ENodeName.action) as ActionNode; FireNode testFireNode = testActionNode.GetChild(ENodeName.fire) as FireNode; Assert.IsNotNull(testFireNode.GetChild(ENodeName.speed)); }
public void CreatedSpeedNode3() { var filename = new Filename(@"FireSpeed.xml"); BulletPattern pattern = new BulletPattern(); pattern.ParseXML(filename.File); ActionNode testActionNode = pattern.RootNode.GetChild(ENodeName.action) as ActionNode; FireNode testFireNode = testActionNode.GetChild(ENodeName.fire) as FireNode; Assert.IsNotNull(testFireNode.GetChild(ENodeName.speed) as SpeedNode); }
public void CreatedBulletRefNode2() { var filename = new Filename(@"BulletRef.xml"); BulletPattern pattern = new BulletPattern(); pattern.ParseXML(filename.File); ActionNode testActionNode = pattern.RootNode.GetChild(ENodeName.action) as ActionNode; FireNode testFireNode = testActionNode.GetChild(ENodeName.fire) as FireNode; Assert.IsNotNull(testFireNode.GetChild(ENodeName.bulletRef)); }
public void SpeedNodeAbsolute() { string filename = @"Content\FireSpeedAbsolute.xml"; BulletPattern pattern = new BulletPattern(); pattern.ParseXML(filename); ActionNode testActionNode = pattern.RootNode.GetChild(ENodeName.action) as ActionNode; FireNode testFireNode = testActionNode.GetChild(ENodeName.fire) as FireNode; SpeedNode testSpeedNode = testFireNode.GetChild(ENodeName.speed) as SpeedNode; Assert.AreEqual(ENodeType.absolute, testSpeedNode.NodeType); }
public void CreatedBulletRefNode3() { string filename = @"Content\BulletRef.xml"; BulletPattern pattern = new BulletPattern(); pattern.ParseXML(filename); ActionNode testActionNode = pattern.RootNode.GetChild(ENodeName.action) as ActionNode; FireNode testFireNode = testActionNode.GetChild(ENodeName.fire) as FireNode; Assert.IsNotNull(testFireNode.GetChild(ENodeName.bulletRef)); Assert.IsNotNull(testFireNode.GetChild(ENodeName.bulletRef) as BulletRefNode); }
public void GotParamNode2() { var filename = TestUtils.GetFilePath(@"Content\BulletRefParam.xml"); BulletPattern pattern = new BulletPattern(); pattern.Parse(filename); ActionNode testActionNode = pattern.RootNode.GetChild(NodeName.action) as ActionNode; FireNode testFireNode = testActionNode.GetChild(NodeName.fire) as FireNode; BulletRefNode refNode = testFireNode.GetChild(NodeName.bulletRef) as BulletRefNode; Assert.IsNotNull(refNode.GetChild(NodeName.param) as ParamNode); }
public void DirectionNodeSequence() { string filename = @"Content\FireDirectionSequence.xml"; BulletPattern pattern = new BulletPattern(); pattern.ParseXML(filename); ActionNode testActionNode = pattern.RootNode.GetChild(ENodeName.action) as ActionNode; FireNode testFireNode = testActionNode.GetChild(ENodeName.fire) as FireNode; DirectionNode testDirectionNode = testFireNode.GetChild(ENodeName.direction) as DirectionNode; Assert.AreEqual(ENodeType.sequence, testDirectionNode.NodeType); }
public void GotParamNode2() { string filename = @"Content\BulletRefParam.xml"; BulletPattern pattern = new BulletPattern(); pattern.ParseXML(filename); ActionNode testActionNode = pattern.RootNode.GetChild(ENodeName.action) as ActionNode; FireNode testFireNode = testActionNode.GetChild(ENodeName.fire) as FireNode; BulletRefNode refNode = testFireNode.GetChild(ENodeName.bulletRef) as BulletRefNode; Assert.IsNotNull(refNode.GetChild(ENodeName.param) as ParamNode); }
public void CreatedTopLevelFireNode() { var filename = new Filename(@"FireEmpty.xml"); BulletPattern pattern = new BulletPattern(); pattern.ParseXML(filename.File); FireNode testFireNode = pattern.RootNode.GetChild(ENodeName.fire) as FireNode; Assert.IsNotNull(testFireNode); Assert.IsNotNull(testFireNode.BulletDescriptionNode); Assert.AreEqual("test", testFireNode.Label); }
public void SpeedNodeSequence() { var filename = new Filename(@"FireSpeedSequence.xml"); BulletPattern pattern = new BulletPattern(); pattern.ParseXML(filename.File); ActionNode testActionNode = pattern.RootNode.GetChild(ENodeName.action) as ActionNode; FireNode testFireNode = testActionNode.GetChild(ENodeName.fire) as FireNode; SpeedNode testSpeedNode = testFireNode.GetChild(ENodeName.speed) as SpeedNode; Assert.AreEqual(ENodeType.sequence, testSpeedNode.NodeType); }
public void GotCorrectFireNode() { var filename = new Filename(@"FireRef.xml"); BulletPattern pattern = new BulletPattern(); pattern.ParseXML(filename.File); ActionNode testActionNode = pattern.RootNode.GetChild(ENodeName.action) as ActionNode; FireRefNode testFireNode = testActionNode.GetChild(ENodeName.fireRef) as FireRefNode; FireNode fireNode = testFireNode.ReferencedFireNode as FireNode; Assert.AreEqual("test", fireNode.Label); }
public void GotActionRefNode3() { var filename = new Filename(@"ActionRefEmpty.xml"); BulletPattern pattern = new BulletPattern(); pattern.ParseXML(filename.File); ActionNode testActionNode = pattern.RootNode.GetChild(ENodeName.action) as ActionNode; FireNode testFireNode = testActionNode.GetChild(ENodeName.fire) as FireNode; BulletNode testBulletNode = testFireNode.GetChild(ENodeName.bullet) as BulletNode; Assert.IsNotNull(testBulletNode.GetChild(ENodeName.actionRef)); }
public void DirectionNodeAbsolute() { var filename = new Filename(@"FireDirectionAbsolute.xml"); BulletPattern pattern = new BulletPattern(); pattern.ParseXML(filename.File); ActionNode testActionNode = pattern.RootNode.GetChild(ENodeName.action) as ActionNode; FireNode testFireNode = testActionNode.GetChild(ENodeName.fire) as FireNode; DirectionNode testDirectionNode = testFireNode.GetChild(ENodeName.direction) as DirectionNode; Assert.AreEqual(ENodeType.absolute, testDirectionNode.NodeType); }
public void FoundBulletNode1() { var filename = new Filename(@"BulletRef.xml"); BulletPattern pattern = new BulletPattern(); pattern.ParseXML(filename.File); ActionNode testActionNode = pattern.RootNode.GetChild(ENodeName.action) as ActionNode; FireNode testFireNode = testActionNode.GetChild(ENodeName.fire) as FireNode; BulletRefNode refNode = testFireNode.GetChild(ENodeName.bulletRef) as BulletRefNode; Assert.IsNotNull(refNode.ReferencedBulletNode as BulletNode); }
/// <summary> /// Initializes a new instance of the <see cref="FireTask"/> class. /// </summary> /// <param name="node">Node.</param> /// <param name="owner">Owner.</param> public FireTask(FireNode node, BulletMLTask owner) : base(node, owner) { Debug.Assert(null != Node); Debug.Assert(null != Owner); _lastFireDirection = 0f; _lastFireSpeed = 0f; _lastFireScale = 0f; _lastSetupDirection = 0f; _lastSetupSpeed = 0f; _lastSetupScale = 0f; _isRunning = false; }
public void FoundCorrectBulletNode() { string filename = @"Content\BulletRefTwoBullets.xml"; BulletPattern pattern = new BulletPattern(); pattern.ParseXML(filename); ActionNode testActionNode = pattern.RootNode.GetChild(ENodeName.action) as ActionNode; FireNode testFireNode = testActionNode.GetChild(ENodeName.fire) as FireNode; BulletRefNode refNode = testFireNode.GetChild(ENodeName.bulletRef) as BulletRefNode; BulletNode testBulletNode = refNode.ReferencedBulletNode as BulletNode; Assert.AreEqual("test2", testBulletNode.Label); }
public void FoundActionNode2() { string filename = @"Content\ActionRefEmpty.xml"; BulletPattern pattern = new BulletPattern(); pattern.ParseXML(filename); ActionNode testActionNode = pattern.RootNode.GetChild(ENodeName.action) as ActionNode; FireNode testFireNode = testActionNode.GetChild(ENodeName.fire) as FireNode; BulletNode testBulletNode = testFireNode.GetChild(ENodeName.bullet) as BulletNode; ActionRefNode testActionRefNode = testBulletNode.GetChild(ENodeName.actionRef) as ActionRefNode; ActionNode refNode = testActionRefNode.ReferencedActionNode as ActionNode; Assert.AreEqual(refNode.Label, "test"); }
public void FoundCorrectActionNode() { var filename = new Filename(@"ActionRefParam.xml"); BulletPattern pattern = new BulletPattern(); pattern.ParseXML(filename.File); ActionNode testActionNode = pattern.RootNode.GetChild(ENodeName.action) as ActionNode; FireNode testFireNode = testActionNode.GetChild(ENodeName.fire) as FireNode; BulletNode testBulletNode = testFireNode.GetChild(ENodeName.bullet) as BulletNode; ActionRefNode testActionRefNode = testBulletNode.GetChild(ENodeName.actionRef) as ActionRefNode; ActionNode refNode = testActionRefNode.ReferencedActionNode as ActionNode; Assert.AreEqual(refNode.Label, "test2"); }
private void CreateNewNode(Vector2 thePosition, int NewNodes) { if (NewNodes == 0) { return; } FireNode newNode = new FireNode(); newNode.m_FireObject = new StaticObject(thePosition, m_sprite); newNode.m_fLifeLeft = (float)Firecracker.random.NextDouble(); newNode.m_fSpeed = (float)Firecracker.random.NextDouble() * 100.0f; newNode.m_vTargetLocation.X = thePosition.X + Firecracker.theRandom.Next(-450, 450); newNode.m_vTargetLocation.Y = thePosition.Y + Firecracker.theRandom.Next(-450, 450); newNode.m_vCurrentLocation = thePosition; newNode.m_iNodesRemaining = NewNodes; m_lFireObjects.Add(newNode); }
public override void update(GameTime gameTime) { for (int i = 0; i < m_lFireObjects.Count(); i++) { FireNode theNode = m_lFireObjects[i]; Vector2 newPos = theNode.m_vTargetLocation - m_lFireObjects[i].m_vCurrentLocation; newPos.Normalize(); newPos *= (float)(m_lFireObjects[i].m_fSpeed * gameTime.ElapsedGameTime.TotalSeconds); theNode.m_vCurrentLocation = m_lFireObjects[i].m_vCurrentLocation + newPos; theNode.m_fLifeLeft -= (float)gameTime.ElapsedGameTime.TotalSeconds; theNode.m_FireObject.position = theNode.m_vCurrentLocation; m_lFireObjects[i] = theNode; if (m_lFireObjects[i].m_fLifeLeft <= 0) { CreateNewNode(m_lFireObjects[i].m_vCurrentLocation, m_lFireObjects[i].m_iNodesRemaining - 1); CreateNewNode(m_lFireObjects[i].m_vCurrentLocation, m_lFireObjects[i].m_iNodesRemaining - 1); m_lFireObjects.RemoveAt(i); i--; continue; } // check the collisions. for (int j = 0; j < Firecracker.level.numberOfObjects(); j++) { GameObject theObj = Firecracker.level.objectAt(j); if (theObj.GetType() == typeof(NPCObject)) { if ((theObj.position - m_lFireObjects[i].m_vCurrentLocation).Length() < 10) { // kill this guy. theObj.toBeDeleted = true; Explosion newDeath = new Explosion(theObj.position); HumanDeath ashDeath = new HumanDeath(theObj.position); Firecracker.level.addObject(newDeath); Firecracker.level.addObject(ashDeath); } } } } base.update(gameTime); }
public void FoundCorrectActionNode() { var filename = TestUtils.GetFilePath(@"Content\ActionRefParam.xml"); BulletPattern pattern = new BulletPattern(); pattern.Parse(filename); ActionNode testActionNode = pattern.RootNode.GetChild(NodeName.action) as ActionNode; Assert.IsNotNull(testActionNode); FireNode testFireNode = testActionNode.GetChild(NodeName.fire) as FireNode; Assert.IsNotNull(testFireNode); BulletNode testBulletNode = testFireNode.GetChild(NodeName.bullet) as BulletNode; Assert.IsNotNull(testBulletNode); ActionRefNode testActionRefNode = testBulletNode.GetChild(NodeName.actionRef) as ActionRefNode; Assert.IsNotNull(testActionRefNode); ActionNode refNode = testActionRefNode.ReferencedActionNode; Assert.IsNotNull(testActionNode); Assert.AreEqual("test2", refNode.Label); }
private void AddNeighborOnce(FireNode neighbor) { _neighbors.Add(neighbor); }
public void AddNeighbor(FireNode neighbor) { _neighbors.Add(neighbor); neighbor.AddNeighborOnce(this); }