static void Main(string[] args) { Weapon[] Tools = new Weapon[10]; Tools[0] = Knife.Instance("knife"); Tools[1] = HandGun.Instance("Пистоль", 7, 70, 100); Tools[2] = Assault.Instance("Автомат", 30, 100, 300); Tools[3] = Knife.Instance("knife"); Tools[4] = HandGun.Instance("Пистоль", 10, 70, 100); Tools[5] = Assault.Instance("Автомат", 30, 100, 300); Tools[6] = Grenade_1.Instance("Граната 1", 80, 20); Tools[7] = Grenade_2.Instance("Граната 2", 40, 20); Tools[8] = Grenade_1.Instance("Граната 1", 80, 20); Tools[9] = Grenade_2.Instance("Граната 2", 40, 20); for (int i = 0; i < 10; i++) { if (Tools[i] != null) { Tools[i].Reload(10); } } for (int i = 0; i < 10; i++) { if (Tools[i] != null) { Tools[i].Shot(0); } } Console.ReadLine(); //Tools[7].Reload(10); //Tools[7].Shot(5); }
public static Assault Instance(string str, int max_blt, int max_dam, int max_dist) { if (instance == null) { instance = new Assault(str, max_blt, max_dam, max_dist); } else { Console.WriteLine("Автомат уже в наличии"); instance = null; } return instance; }
public static Assault Instance(string str, int max_blt, int max_dam, int max_dist) { if (instance == null) { instance = new Assault(str, max_blt, max_dam, max_dist); } else { Console.WriteLine("Автомат уже в наличии"); instance = null; } return(instance); }