Пример #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}");
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            Player player = new Player();

            do
            {
                player.Hit();
                Console.WriteLine("Is player alive: " + player.IsAlive);
            } while (player.IsAlive);
        }
Пример #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);
            }
        }
Пример #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);
            }
        }
Пример #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);
            }
        }
Пример #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);
            }
        }