public void createPlayerProjectile()
 {
     //projectileObjectList.Clear();
     Projectile tempProjectile = new Projectile(player.Position, player.Rotation);
     tempProjectile.LoadContent(contentManager);
     projectileObjectList.Add(tempProjectile);
 }
Ejemplo n.º 2
0
        //ProjectileV2 creation method for enemy class
        private void ShootProjectileV2()
        {
            //if the enemy is alive
            if (alive == true)
            {
                //set this create new flag to true
                bool aCreateNew = true;

                //and then for each bullet in the bullet list
                foreach (Projectile aProjectile in mBullets)
                {
                    //if it's not currently being shot
                    if (aProjectile.Visible == false)
                    {
                        aCreateNew = false;     //set the flag back to false to avoid a loop
                        //aProjectile.Fire(Position,
                        //    400, mRotation);// adjusted fire speed
                        break;
                    }
                }

                //if you reach the end of the bullet list without changing the create flag
                if (aCreateNew == true)
                {
                    //create a new ProjectileV2, init it, add it to the list, and shoot it
                    Projectile aProjectile = new Projectile();
                    aProjectile.LoadContent(mContentManager);
                    //aProjectile.Fire(Position,
                    //    400, mRotation);
                    mBullets.Add(aProjectile);
                }
            }
        }