BulletMLLib.Bullet.InitBullet C# (CSharp) Method

InitBullet() public abstract method

After the creation, initialize the bullet with its data (like the correct sprite, etc)
public abstract InitBullet ( ) : void
return void
        public abstract void InitBullet();

Usage Example

Esempio n. 1
0
        /// <summary>
        /// Run this task and all subtasks against a bullet
        /// This is called once a frame during runtime.
        /// </summary>
        /// <returns>ERunStatus: whether this task is done, paused, or still running</returns>
        /// <param name="bullet">The bullet to update this task against.</param>
        public override ERunStatus Run(Bullet bullet)
        {
            //Create the new bullet
            Bullet newBullet = bullet.MyBulletManager.CreateBullet(bullet, false);

            if (newBullet == null)
            {
                //wtf did you do???
                TaskFinished = true;
                return(ERunStatus.End);
            }

            //set the location of the new bullet
            newBullet.X = bullet.X;
            newBullet.Y = bullet.Y;

            //set the direction of the new bullet
            newBullet.Direction = FireDirection;

            //set teh speed of the new bullet
            newBullet.Speed = FireSpeed;

            //initialize the bullet with the bullet node stored in the Fire node
            FireNode myFireNode = Node as FireNode;

            System.Diagnostics.Debug.Assert(null != myFireNode);

            newBullet.InitNode(myFireNode.BulletDescriptionNode);

            // Let the bullet handler initialize the bullet ingame data
            newBullet.InitBullet();

            //set the owner of all the top level tasks for the new bullet to this dude
            foreach (BulletMLTask task in newBullet.Tasks)
            {
                task.Owner = this;
            }

            TaskFinished = true;
            return(ERunStatus.End);
        }