/// <summary> /// Finds the referenced bullet node. /// </summary> public void FindMyBulletNode() { if (null == ReferencedBulletNode) { //Find the action node this dude references BulletMLNode refNode = GetRootNode().FindLabelNode(Label, NodeName.bullet); //make sure we foud something if (null == refNode) { throw new NullReferenceException("Couldn't find the bullet node \"" + Label + "\""); } ReferencedBulletNode = refNode as BulletNode; if (null == ReferencedBulletNode) { throw new NullReferenceException("The BulletMLNode \"" + Label + "\" isn't a bullet node"); } } }
/// <summary> /// Validates the node. /// Overloaded in child classes to validate that each type of node follows the correct business logic. /// This checks stuff that isn't validated by the XML validation /// </summary> public override void ValidateNode() { base.ValidateNode(); // Check for a bullet node BulletDescriptionNode = GetChild(NodeName.bullet) as BulletNode; // If it didn't find one, check for the bulletRef node if (null == BulletDescriptionNode) { // Make sure that dude knows what he's doing var refNode = GetChild(NodeName.bulletRef) as BulletRefNode; if (refNode != null) { refNode.FindMyBulletNode(); BulletDescriptionNode = refNode.ReferencedBulletNode; } } Debug.Assert(null != BulletDescriptionNode, "A <fire> node must contain a <bullet> or a <bulletRef> node."); }