public void Hizlan(string dusmanTuru, bool hizli) { if (hizli == true) { dusmanAdapter = new DusmanAdapter(dusmanTuru); Console.WriteLine("Dusman " + dusmanTuru + " hizli."); dusmanAdapter.Hizlan(dusmanTuru, hizli); } else { dusmanAdapter = new DusmanAdapter(dusmanTuru); Console.WriteLine("Dusman " + dusmanTuru + " yavas."); dusmanAdapter.Hizlan(dusmanTuru, hizli); } }
public void SilahKullan(string dusmanTuru, bool silah) { if (silah == true) { dusmanAdapter = new DusmanAdapter(dusmanTuru); Console.WriteLine("Dusman " + dusmanTuru + " ates etti."); dusmanAdapter.SilahKullan(dusmanTuru, silah); } else { dusmanAdapter = new DusmanAdapter(dusmanTuru); Console.WriteLine("Dusman" + dusmanTuru + " tarafindan saldiri yok."); dusmanAdapter.SilahKullan(dusmanTuru, silah); } }
static void Main(string[] args) { //Client DusmanTank t1 = new DusmanTank(); t1.SilahKullan("tank", true); t1.Hizlan("tank", false); t1.DusmanAdi("tank", "Düşman1"); DusmanRobotu robot1 = new DusmanRobotu(); robot1.YumrukAt("robot", true); robot1.Yuru("robot", true); robot1.RobotIsim("robot", "Düşman2"); /* Adaptasyonu burada kullanıyoruz. */ IDusman dusman = new DusmanAdapter("robot"); dusman.SilahKullan("robot", false); dusman.Hizlan("robot", true); dusman.DusmanAdi("robot", "Düşman3"); Console.ReadLine(); }
public void DusmanAdi(string dusmanTuru, string dusmanAdi) { dusmanAdapter = new DusmanAdapter(dusmanTuru); Console.WriteLine("Dusman " + dusmanTuru + "'a " + dusmanAdi + " ismi verildi."); dusmanAdapter.DusmanAdi(dusmanTuru, dusmanAdi); }