Beispiel #1
0
        static void Main(string[] args)
        {
            string command     = string.Empty;
            int    meters      = 0;
            Hero   svetiGeorgi = new Hero(new SmallSword(), new Walking());

            Console.WriteLine("Hello Goshe");
            Console.WriteLine(string.Format("Second level: after {0} meters", METERS_REQUIRED_LEVEL_2));
            Console.WriteLine(string.Format("Third level: after {0} meters", METERS_REQUIRED_LEVEL_3));
            Console.WriteLine(string.Format("God level: after {0} meters", FAR_FAR_AWAY));

            while (!command.Equals(QUIT_COMMAND))
            {
                command = Console.ReadLine();

                switch (command)
                {
                case MOVE_COMMAND:
                    meters += svetiGeorgi.Move();
                    ChooseGear(meters, svetiGeorgi);
                    Console.WriteLine(string.Format("Current distance: {0} meters", meters));
                    break;

                case ATTACK_COMMAND:
                    svetiGeorgi.Attack();
                    break;

                case INFO_COMMAND:
                    Console.WriteLine(svetiGeorgi.Preview());
                    break;
                }
            }

            Console.WriteLine("The game is over.");
            Console.ReadLine();
        }