Danmaku_no_Kyojin.BulletEngine.BulletMLNode.GetChild C# (CSharp) Method

GetChild() public method

public GetChild ( ENodeName name ) : BulletMLNode
name ENodeName
return BulletMLNode
        public BulletMLNode GetChild(ENodeName name)
        {
            foreach (BulletMLNode node in ChildNodes)
            {
                if (node.Name == name)
                {
                    return node;
                }
            }
            return null;
        }

Usage Example

示例#1
0
        /// <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);
                }
            }
        }
All Usage Examples Of Danmaku_no_Kyojin.BulletEngine.BulletMLNode::GetChild