Esempio n. 1
0
        static void Main(string[] args)
        {
            Player player = new Player();

            for (int i = 0; i < 20; i++)
            {
                player.Hit();
                Console.WriteLine($"Is player alive : {player.IsAlive}");
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Player player = new Player();

            do
            {
                player.Hit();
                Console.WriteLine("Is player alive: " + player.IsAlive);
            } while (player.IsAlive);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Player player = new Player();

            for (int i = 0; i < 20; i++)
            {
                player.Hit();
                Console.WriteLine("Is player alive: " + player.IsAlive);
            }
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            Player player = new Player();

            for (int i = 0; i < 20; i++)
            {
                player.Hit();
                player.CheckDeath();
                Console.WriteLine("Is player alive: " + player.isAlive);
            }
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            Player player = new Player();

            for (int i = 0; i < 20 && player.bored; i++)
            {
                //player.bored = false;
                player.Hit();
                Console.WriteLine("Is player alive: " + player.isAlive);
            }
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            Player player = new Player();

            //can't do this because property is read-only
            //properties great way to embed functionality
            //into getters and setters
            //player.IsAlive = false;

            for (int i = 0; i < 20; i++)
            {
                player.Hit();
                Console.WriteLine("Is player alive" + player.IsAlive);
            }
        }