public override void Add(Point mouseLocation) { NormalShotgun gun = new NormalShotgun(); gun.Location = mouseLocation; gun.IdItem = model.Map.ListItems.Count; model.Map.ListItems.Add(gun); }
public bool GenerateItems() //карта { try { Random n = new Random(); List <Item> ListItems = new List <Item>(); int Count = model.Map.MapBorders.Height * model.Map.MapBorders.Width / 450000; for (int i = 0; i < Count; i++) { NormalShotgun gun = new NormalShotgun(); Thread.Sleep(7); gun.Location = new Point(n.Next(0, model.Map.MapBorders.Width), n.Next(0, model.Map.MapBorders.Height)); gun.IdItem = ListItems.Count; ListItems.Add(gun); } for (int i = 0; i < Count; i++) { NormalGun gun = new NormalGun(); Thread.Sleep(8); gun.Location = new Point(n.Next(0, model.Map.MapBorders.Width), n.Next(0, model.Map.MapBorders.Height)); gun.IdItem = ListItems.Count; ListItems.Add(gun); } for (int i = 0; i < Count; i++) { Grenade grenade = new Grenade(); Thread.Sleep(8); grenade.Location = new Point(n.Next(0, model.Map.MapBorders.Width), n.Next(0, model.Map.MapBorders.Height)); grenade.IdItem = ListItems.Count; ListItems.Add(grenade); } for (int i = 0; i < Count; i++) { NormalPistol pistol = new NormalPistol(); Thread.Sleep(8); pistol.Location = new Point(n.Next(0, model.Map.MapBorders.Width), n.Next(0, model.Map.MapBorders.Height)); pistol.IdItem = ListItems.Count; ListItems.Add(pistol); } model.Map.ListItems = ListItems; return(true); } catch { return(false); } }