Esempio n. 1
0
        public void CreateCharacter()
        {
            IEquipment userEquipment;
            ConsoleKey response;
            int        rolls = 3;

            string userName = cw.GetUserName();

            userEquipment = manager.GetEquipment(EquipmentType.Weapon);
            Console.WriteLine(userEquipment.GetInfo());
            do
            {
                do
                {
                    Console.Write($"Do you want to re-roll this item? [remaining rolls:{ rolls }] [y/n] ");
                    response = Console.ReadKey(false).Key;
                    if (response != ConsoleKey.Enter)
                    {
                        Console.WriteLine("\n");
                    }
                } while (response != ConsoleKey.Y && response != ConsoleKey.N);

                if (rolls != 0 && response != ConsoleKey.N)
                {
                    Console.Clear();
                    userEquipment = manager.GetEquipment(EquipmentType.Weapon);
                    Console.WriteLine(userEquipment.GetInfo());
                }

                rolls--;
            } while (rolls != 0 && response != ConsoleKey.N);

            Console.Clear();
            do
            {
                Console.Write($"Name: {userName}\n\n{userEquipment.GetInfo()}\n\nDo you want to create again? [y/n] ");
                response = Console.ReadKey(false).Key;
                if (response != ConsoleKey.Enter)
                {
                    Console.WriteLine("\n");
                }
            } while (response != ConsoleKey.Y && response != ConsoleKey.N);

            if (response == ConsoleKey.Y)
            {
                Console.Clear();
                CreateCharacter();
                return;
            }

            Weapon weapon = new Weapon(userEquipment.GetName(), userEquipment.GetRating(), userEquipment.GetWeight(), userEquipment.GetValue());

            player = new Player(userName, 100, weapon);

            Console.Clear();
        }
Esempio n. 2
0
        private void GetArmour(List <IEquipment> equipments, FactoryMethodManager factoryManager)
        {
            Console.Clear();

            IEquipment armour = factoryManager.GetEquipment(EquipmentType.Armour);

            Console.WriteLine($"{armour.GetInfo()}\n\n");

            equipments.Add(armour);
        }
Esempio n. 3
0
        private void GetEquipment(List <IEquipment> equipments, FactoryMethodManager factoryManager)
        {
            Console.Clear();

            IEquipment weapon = factoryManager.GetEquipment(EquipmentType.Weapon);

            Console.WriteLine($"{weapon.GetInfo()}\n\n");

            equipments.Add(weapon);
        }