public void UseWeaponForAllCreatures(Weapon.Weapon weapon) { var count = 0; foreach (var gameObject in gameObjects) { if (gameObject is ICreature && gameObject is ICanReactOnWeapon reactOnWeapon) { count++; reactOnWeapon.ReactOnWeapon(weapon, this); } } MessageBox.Show( $"Вы использовали оружие 'Демократия'!\nВ тюрьму посажено {count} существ на {weapon.Force} ходов!\nСлава Pутэну!"); }
public void ChangeWeapon() { if (weapons.Count == 0) { return; } var index = weapons.IndexOf(CurrentWeapon); if (index + 1 < weapons.Count) { CurrentWeapon = weapons[index + 1]; NotifyWeaponChanged?.Invoke(); return; } CurrentWeapon = weapons[0]; NotifyWeaponChanged?.Invoke(); }
public void AddWeapon(Weapon.Weapon weapon) { weapons.Add(weapon); CurrentWeapon = weapon; NotifyWeaponChanged?.Invoke(); }