Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Human matt = new Human("matt", 3, 90, 3, 100);
            Human zoe  = new Human("zoe", 3, 90, 3, 100);


            System.Console.WriteLine(matt.Name);
            System.Console.WriteLine(zoe.Name);
            System.Console.WriteLine(matt.Strength);
            System.Console.WriteLine(matt.Intelligence);
            System.Console.WriteLine(matt.Dexterity);
            System.Console.WriteLine(matt.health);



            matt.Attack(zoe);
            System.Console.WriteLine(zoe.health);


            zoe.TakeDmg(10);
            zoe.Attack(matt);


            System.Console.WriteLine(matt.health);
            System.Console.WriteLine(zoe.health);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Human bob = new Human("bob", 3, 90, 3, 100); //this ording has to match the construction function parrameters.
            Human joe = new Human("joe", 3, 90, 3, 100); //this ording has to match the construction function parrameters.

            System.Console.WriteLine(bob.Name);
            System.Console.WriteLine(joe.Name);
            System.Console.WriteLine(bob.Strength);
            System.Console.WriteLine(bob.Intelligence);
            System.Console.WriteLine(bob.Dexterity);
            System.Console.WriteLine(bob.health);//note private field has a different name in this case lowercase
            bob.Attack(joe);
            System.Console.WriteLine(joe.health);
            joe.TakeDmg(10);
            joe.Attack(bob);
            System.Console.WriteLine(bob.health);
            System.Console.WriteLine(joe.health);
        }