Parse() public method

Parse a specified node and bullet into this task
public Parse ( BulletMLNode myNode, Bullet bullet ) : void
myNode BulletMLNode the node for this dude
bullet Bullet the bullet this dude is controlling
return void
Ejemplo n.º 1
0
        /// <summary>
        /// This bullet is fired from another bullet, initialize it from the node that fired it
        /// </summary>
        /// <param name="subNode">Sub node that defines this bullet</param>
        public void Init(BulletMLNode subNode)
        {
            Debug.Assert(null != subNode);

            //clear everything out
            _activeTaskNum = 0;

            //Grab that top level node
            MyNode = subNode;

            //Either get the first task, or create a task for the node
            //If this dude is from a FireRef task, there will already be a plain task in there with all the required params
            BulletMLTask task = ((0 != _tasks.Count) ? _tasks[0] : CreateTask());

            //parse the nodes into the task list
            task.Parse(subNode, this);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initialize this bullet with a top level node
        /// </summary>
        /// <param name="rootNode">This is a top level node... find the first "top" node and use it to define this bullet</param>
        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);
                    }
                }
            }
        }