public override void Update(Vector2 playerPosition)
        {
            if ((CurCharge >= chargeTime) && BulletList.Count < 4 && _fired == false)
            {
                BulletList.Add(new Bullet(new Vector2(shipLocation.X + Width, shipLocation.Y + Height / 2), Globals.GameWindowY / BulletScale, (Globals.GameWindowY / BulletScale) * (bulletTexture.Bounds.Height / bulletTexture.Bounds.Width), 0, BulYVel));
                BulYVel   = BulYVel * -1;
                CurCharge = 0;
            }
            else if (BulletList.Count >= 4 && _fired == false)
            {
                _fired = true;
                FireBullet(playerPosition);
            }
            else if (_fired && BulletList.Count == 0)
            {
                _fired = false;
            }
            CurCharge++;

            if (BulletList.Count != 0)
            {
                for (int i = BulletList.Count - 1; i >= 0; i--)
                {
                    if (BulletList[i].BulletLocation.X > 0 && BulletList[i].BulletLocation.X < Globals.GameWindowX && BulletList[i].BulletLocation.Y > 0 && BulletList[i].BulletLocation.Y < Globals.GameWindowY)
                    {
                        BulletList[i].Update();
                    }
                    else
                    {
                        BulletList.RemoveAt(i);
                    }
                }
            }
        }
Beispiel #2
0
 public void BulletUpdate()
 {
     if (BulletList.Count != 0)
     {
         for (int i = BulletList.Count - 1; i >= 0; i--)
         {
             if (BulletList[i].BulletLocation.X > Globals.GameWindowX)
             {
                 BulletList.RemoveAt(i);
             }
             else
             {
                 BulletList[i].Update();
             }
         }
     }
     if (CurBulletCoolDown < BulletCoolDown)
     {
         CurBulletCoolDown += 1;
     }
 }