Danmaku_no_Kyojin.BulletEngine.Bullet.InitTop C# (CSharp) Method

InitTop() public method

Initialize this bullet with a top level node
public InitTop ( BulletMLNode rootNode ) : void
rootNode BulletMLNode This is a top level node... find the first "top" node and use it to define this bullet
return void
        public void InitTop(BulletMLNode rootNode)
        {
            Debug.Assert(null != rootNode);

            //clear everything out
            _tasks.Clear();
            _fireData.Clear();
            _activeTaskNum = 0;

            //Grab that top level node
            MyNode = rootNode;

            //okay find the item labelled 'top'
            BulletMLNode topNode = rootNode.FindLabelNode("top", ENodeName.action);
            if (topNode != null)
            {
                //We found a top node, add a task for it, also add a firedata for the task
                BulletMLTask task = CreateTask();

                //parse the nodes into the task list
                task.Parse(topNode, this);
            }
            else
            {
                //ok there is no 'top' node, so that means we have a list of 'top#' nodes
                for (int i = 1; i < 10; i++)
                {
                    topNode = rootNode.FindLabelNode("top" + i, ENodeName.action);
                    if (topNode != null)
                    {
                        //found a top num node, add a task and firedata for it
                        BulletMLTask task = CreateTask();

                        //parse the nodes into the task list
                        task.Parse(topNode, this);
                    }
                }
            }
        }