BulletMLLib.BulletMLTree.GetChild C# (CSharp) Method

GetChild() public method

public GetChild ( BLName name ) : BulletMLTree
name BLName
return BulletMLTree
        public BulletMLTree GetChild(BLName name)
        {
            foreach (BulletMLTree node in children)
            {
                if (node.name == name)
                    return node;
            }
            return null;
        }

Usage Example

示例#1
0
        public override BLRunStatus Run(BulletMLBullet bullet)
        {
            if (first)
            {
                first = false;
                if (node.GetChild(BLName.Speed).type == BLType.Sequence)
                {
                    changeSpeed = node.GetChildValue(BLName.Speed, this);
                }
                else if (node.GetChild(BLName.Speed).type == BLType.Relative)
                {
                    changeSpeed = node.GetChildValue(BLName.Speed, this) / term;
                }
                else
                {
                    changeSpeed = (node.GetChildValue(BLName.Speed, this) - bullet.Speed) / term;
                }
            }

            term--;

            bullet.Speed += changeSpeed;

            // if (bullet.index == DISP_BULLET_INDEX)  Debug.WriteLine(String.Format("ChangeSpeed:{0} (type:{1} val:{2})", bullet.Speed, node.GetChild(BLName.Speed).type, node.GetChildValue(BLName.Speed, this)));

            if (term <= 0)
            {
                end = true;
                return(BLRunStatus.End);
            }
            else
            {
                return(BLRunStatus.Continue);
            }
        }
All Usage Examples Of BulletMLLib.BulletMLTree::GetChild