public bool Harcol(Harcos ellenfel) { ellenfel.Eletero = ellenfel.Eletero - this.harciero; this.eletero = this.eletero - ellenfel.Harciero; if (this.eletero <= 0 || ellenfel.Eletero <= 0) { return(true); } else { return(false); } }
static void Main(string[] args) { Harcos h1 = new Harcos("Yoda", 100, 50); Harcos h2 = new Harcos("Dookoo", 100, 30); while (!h1.Harcol(h2)) { h1.Harcol(h2); Console.WriteLine(h1.ToString()); Console.WriteLine(h2.ToString()); } Console.ReadKey(); }