/// <summary>
/// Initializes a new instance of the <see cref="BulletMLLib.BulletMLFire"/> class.
/// </summary>
/// <param name="node">Node.</param>
/// <param name="owner">Owner.</param>
public BulletMLFire(BulletMLNode node, BulletMLTask owner)
: base(node, owner)
{
Debug.Assert(null != Node);
Debug.Assert(null != Owner);
//First try and get the nodes striaght from our node
DirNode = node.GetChild(ENodeName.direction);
SpeedNode = node.GetChild(ENodeName.speed);
RefNode = node.GetChild(ENodeName.bulletRef);
BulletNode = node.GetChild(ENodeName.bullet);
//ok fire nodes HAVE TO have either a ref or a bullet node
Debug.Assert((null != RefNode) || (null != BulletNode));
//what we gonna use to set the direction if we couldnt find a node?
if (null == DirNode)
{
if (null != RefNode)
{
//Get the direction from the reference node
DirNode = RefNode.GetChild(ENodeName.direction);
}
else if (BulletNode != null)
{
//Set teh driection from teh bullet node
DirNode = BulletNode.GetChild(ENodeName.direction);
}
}
//what we gonna use to set teh speed if we couldnt find a node?
if (null == SpeedNode)
{
if (null != RefNode)
{
//set the speed from teh refernce node
SpeedNode = RefNode.GetChild(ENodeName.speed);
}
else if (null != BulletNode)
{
//set teh speed from the bullet node
SpeedNode = BulletNode.GetChild(ENodeName.speed);
}
}
}