/// <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 InitNode(BulletMLNode subNode) { Debug.Assert(null != subNode); //clear everything out Tasks.Clear(); //Grab that top level node MyNode = subNode; //found a top num node, add a task for it BulletMLTask task = new BulletMLTask(subNode, null); //parse the nodes into the task list task.ParseTasks(this); //initialize all the tasks task.InitTask(this); Tasks.Add(task); //Check if we should change the start heading and speed to adjust for an initial velocity if (Vector2.Zero != InitialVelocity) { //now that the heading and speed have been set, adjust them according to the initial velocity. Vector2 final = (Direction.ToVector2() * Speed * Scale) + InitialVelocity; Direction = final.Angle(); Speed = final.Length() / Scale; } }
/// <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 InitNode(BulletMLNode subNode) { Debug.Assert(null != subNode); //clear everything out Tasks.Clear(); //Grab that top level node MyNode = subNode; //found a top num node, add a task for it BulletMLTask task = new BulletMLTask(subNode, null); //parse the nodes into the task list task.ParseTasks(this); //initialize all the tasks task.InitTask(this); Tasks.Add(task); }
/// <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 InitNode(BulletMLNode subNode) { System.Diagnostics.Debug.Assert(null != subNode); //clear everything out Tasks.Clear(); //Grab that top level node MyNode = subNode; //found a top num node, add a task for it BulletMLTask task = new BulletMLTask(subNode, null); //parse the nodes into the task list task.ParseTasks(this); //initialize all the tasks task.InitTask(this); Tasks.Add(task); }