/// <summary> /// Finds the referenced bullet node. /// </summary> public void FindMyBulletNode() { if (null == ReferencedBulletNode) { //Find the action node this dude references var refNode = GetRootNode().FindLabelNode(Label, ENodeName.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(ENodeName.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 if (GetChild(ENodeName.bulletRef) is BulletRefNode refNode) { refNode.FindMyBulletNode(); BulletDescriptionNode = refNode.ReferencedBulletNode; } } Debug.Assert(null != BulletDescriptionNode); }