示例#1
0
        public void ShootGun(Gun BMGun)
        {
            MouseState     = Mouse.GetState();
            MousePostion.X = MouseState.X;
            MousePostion.Y = MouseState.Y;


            if (BMGun.CoolDown <= 0 && BMGun.RemainingClip > 0)
            {
                //Semis
                if (!BMGun.Shot)
                {
                    if (BMGun._Weapons == Weapons.Glock || BMGun._Weapons == Weapons.DualGlock)
                    {
                        Bullets = new Bullets(Game1, MousePostion, BMGun.Location, BMGun.Attack, BMGun.Spread, false);
                        Bullets.Initialize();
                        bullets.Add(Bullets);
                        BMGun.RemainingClip--;
                        BMGun.CoolDown = Gun.TimeBetweenShots;
                    }
                    //Shotgun
                    if (BMGun._Weapons == Weapons.M4ShotGun)
                    {
                        for (int i = 0; i < 20; i++)
                        {
                            Bullets = new Bullets(Game1, MousePostion, BMGun.Location, BMGun.Attack, random.Next(BMGun.Spread - 50) + 1, false);
                            Bullets.Initialize();
                            bullets.Add(Bullets);
                        }
                        BMGun.RemainingClip--;
                        BMGun.CoolDown = Gun.TimeBetweenShots;
                    }
                    //Sniper
                    if (BMGun._Weapons == Weapons.M40A3)
                    {
                        Bullets = new Bullets(Game1, MousePostion, BMGun.Location, BMGun.Attack, BMGun.Spread, true);
                        Bullets.Initialize();
                        bullets.Add(Bullets);
                        BMGun.RemainingClip--;
                        BMGun.CoolDown = Gun.TimeBetweenShots;
                    }
                    if (BMGun._Weapons == Weapons.Empty)
                    {
                        //Nothing in Hand, Do nothing;
                    }
                }
                //Autos
                if (BMGun._Weapons == Weapons.P90 || BMGun._Weapons == Weapons.ScarL || BMGun._Weapons == Weapons.Minigun)
                {
                    Bullets = new Bullets(Game1, MousePostion, BMGun.Location, BMGun.Attack, BMGun.Spread, false);
                    Bullets.Initialize();
                    bullets.Add(Bullets);
                    BMGun.RemainingClip--;
                    BMGun.CoolDown = Gun.TimeBetweenShots;
                }

                if (BMGun.RemainingClip == 0)
                {
                    if (BMGun._Weapons == Weapons.Glock || BMGun._Weapons == Weapons.DualGlock || BMGun._Weapons == Weapons.P90)
                    {
                        GunManager.PistolAmmo -= BMGun.Reload(GunManager.PistolAmmo);
                    }
                    if (BMGun._Weapons == Weapons.M4ShotGun)
                    {
                        GunManager.ShotgunAmmo -= BMGun.Reload(GunManager.ShotgunAmmo);
                    }
                    if (BMGun._Weapons == Weapons.ScarL || BMGun._Weapons == Weapons.M40A3 || BMGun._Weapons == Weapons.Minigun)
                    {
                        GunManager.HeavyAmmo -= BMGun.Reload(GunManager.HeavyAmmo);
                    }
                }
            }
        }
示例#2
0
 public void GetHit(Bullets b)
 {
     this.health -= b.Attack;
 }