Exemple #1
0
 public void Attack(HumanBeing enemy)
 {
     enemy.health -= 5 * strength;
     Console.WriteLine($"The attacker:{name} {strength} ");
     Console.WriteLine($"Enemy Name: {enemy.name}, Health:{enemy.health}");
     health -= 5 * enemy.strength;
     Console.WriteLine($"{name} attacked {enemy.name} and his health dropped to:{health}");
 }
Exemple #2
0
        static void Main(string[] args)
        {
            HumanBeing bob  = new HumanBeing("Claire");
            HumanBeing josh = new HumanBeing("Josh");

            bob.Attack(josh);
            Console.WriteLine(josh.Health);
            Console.WriteLine("Hello World!");
        }
Exemple #3
0
        static void Main(string[] args)
        {
            HumanBeing john = new HumanBeing("John");
            //john.PrintArray();

            HumanBeing freddy = new HumanBeing("freddy", 25, 50, 100, 5);

            //freddy.PrintArray();
            freddy.Attack(john);
            // this of these command above as 2 objects interacting with each other
            // the objects 'freddy' and 'john' has access to any methods or attribute
            // including (name, intelligence, strength, health, and dexterity) plus the method 'Attack'
            john.Attack(freddy);
        }
Exemple #4
0
 public int Attack(HumanBeing target)
 {
     target.health -= 5 * Strength;
     return(target.health);
 }