namespace ConsoleAppCounterStrikeIanXIa25_02_2021
static void Main(string[] args)
Terorist terorist = new Terorist("call_me_Piotr", );
public interface ICanShoot
public void ShootAtPlayer(Player player)
Console.WriteLine("{2} the {3} is shooting at {0} the {1}",
player.Nickname, player.GetType().Name, this.nickname, this.GetType().Name);
if (player.isAlive && player.Health >= 40)
else if (player.Health == 20)
Console.WriteLine("{0} the {2} killed {1} the {3}",
this.Nickname, player.Nickname, this.GetType().Name, player.GetType().Name);
private int health = 100;
public Player(string nickname, bool isAlive, int health)
this.Nickname = nickname;
public override string ToString()
return string.Format("{0}: {1}; {2}: {3}",
this.GetType().Name, this.Nickname, this.isAlive == true ? "Alive" : "Dead", this.Health);
throw new ArgumentNullException("Write player's nickname!");
public class Terorist : Player, ICanShoot
public Terorist(string nickname, bool isAlive, int health)
: base ( nickname, isAlive, health)
public void ShootAtPlayer()
Console.WriteLine("Bomb has been planted!");
public class CounterTerorist : Player, ICanShoot
public CounterTerorist(string nickname, bool isAlive, int health)
: base(nickname, isAlive, health)
public void ShootAtPlayer()
Console.WriteLine("Defusing bomb!");
Console.WriteLine("Bomb defused!");
public void ResqueHostages()
Console.WriteLine("Hostages are safe!");
public class Hostages : Player