using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace atzimes_darbs { public class Player { public string name; public int HP; public Player(string name, int HP) { this.name = name; this.HP = HP; } } public abstract class Gun { public int ammo; public abstract void GunAcction(Player speletaji); } public class desert_eagle : Gun { public string name; public int dmg; public desert_eagle(string name, int dmg,int ammo) { this.name = name; this.dmg = dmg; this.ammo = ammo; } public override void GunAcction(Player speletaji) { speletaji.HP -= dmg; Console.WriteLine($"{speletaji.name} HP:{speletaji.HP} - {dmg} = {speletaji.name} HP:{speletaji.HP}"); System.Threading.Thread.Sleep(500); } } public class AK_47 : Gun { public string name; public int dmg; public AK_47(string name, int dmg, int ammo) { this.name = name; this.dmg = dmg; this.ammo = ammo; } public override void GunAcction(Player speletaji) { speletaji.HP -= dmg; Console.WriteLine($"{speletaji.name} HP:{speletaji.HP} - {dmg} = {speletaji.name} HP:{speletaji.HP}"); System.Threading.Thread.Sleep(500); } } public class M4A4 : Gun { public string name; public int dmg; public M4A4(string name, int dmg, int ammo) { this.name = name; this.dmg = dmg; this.ammo = ammo; } public override void GunAcction(Player speletaji) { speletaji.HP -= dmg; Console.WriteLine($"{speletaji.name} HP:{speletaji.HP} - {dmg} = {speletaji.name} HP:{speletaji.HP}"); System.Threading.Thread.Sleep(500); } } public class AWP : Gun { public string name; public int dmg; public AWP(string name, int dmg, int ammo) { this.name = name; this.dmg = dmg; this.ammo = ammo; } public override void GunAcction(Player speletaji) { speletaji.HP -= dmg; Console.WriteLine($"{speletaji.name} HP:{speletaji.HP} - {dmg} = {speletaji.name} HP:{speletaji.HP}"); System.Threading.Thread.Sleep(500); } } public class SSG08 : Gun { public string name; public int dmg; public SSG08(string name, int dmg, int ammo) { this.name = name; this.dmg = dmg; this.ammo = ammo; } public override void GunAcction(Player speletaji) { speletaji.HP -= dmg; Console.WriteLine($"{speletaji.name} HP:{speletaji.HP} - {dmg} = {speletaji.name} HP:{speletaji.HP}"); System.Threading.Thread.Sleep(500); } } public class glock_18 : Gun { public string name; public int dmg; public glock_18(string name, int dmg, int ammo) { this.name = name; this.dmg = dmg; this.ammo = ammo; } public override void GunAcction(Player speletaji) { speletaji.HP -= dmg; Console.WriteLine($"{speletaji.name} HP:{speletaji.HP} - {dmg} = {speletaji.name} HP:{speletaji.HP}"); System.Threading.Thread.Sleep(500); } } public class USP_S : Gun { public string name; public int dmg; public USP_S(string name, int dmg, int ammo) { this.name = name; this.dmg = dmg; this.ammo = ammo; } public override void GunAcction(Player speletaji) { speletaji.HP -= dmg; Console.WriteLine($"{speletaji.name} HP:{speletaji.HP} - {dmg} = {speletaji.name} HP:{speletaji.HP}"); System.Threading.Thread.Sleep(500); } } public class Program { static void Main(string[] args) { Player[] speletaji = { new Player("player1",100), new Player("player2",100), }; Gun[] ieroci = { new desert_eagle("Desert_eagle",53,21), new AK_47("AK-47",35,90), new M4A4("M4A4",33,120), new AWP("AWP",115,15), new SSG08("SSG08",88,30), new glock_18("glock_18",24,80), new USP_S("USP-S",35,36) }; ieroci[0].GunAcction(speletaji[0]); Console.ReadKey(); } } }