示例#1
0
        public void unequipArmor()
        {
            if (_hasArmor)
            {
                Console.WriteLine("Unequiped armor.");
                _hasArmor    = false;
                CurrentArmor = null;
            }

            else
            {
                Console.WriteLine("There is no armor equipped");
            }
        }
示例#2
0
        //armor System
        // Displays a menu that allows the player to pick from a list of available armor
        // Sets the current Armor to the armor the player selected
        public void equipArmor()
        {
            string menu3 = "";

            if (!_hasArmor)
            {
                while (menu3 != "0")
                {
                    Console.WriteLine("\nArmor list");
                    Console.WriteLine("0: Back");
                    Console.WriteLine("1: Leather");
                    Console.WriteLine("2: Iron");
                    Console.WriteLine("3: Steel");
                    Console.WriteLine("4: Platnium");

                    string choice2 = "";

                    choice2 = Console.ReadLine();
                    Console.WriteLine("");


                    if (choice2 == "0")
                    {
                        menu3 = "0";
                    }

                    else if (choice2 == "1")
                    {
                        if (checkWeight(_weightFromWeapon, 15))
                        {
                            Console.WriteLine("Equipped Leather tunic.");
                            CurrentArmor = _armor[0];
                            CurrentArmor.Print();
                            _hasArmor = true;
                            menu3     = "0";
                        }

                        else
                        {
                            Console.WriteLine("Weight limit reached");
                        }
                    }

                    else if (choice2 == "2")
                    {
                        if (checkWeight(_weightFromWeapon, 20))
                        {
                            Console.WriteLine("Equipped Iron armor.");
                            CurrentArmor = _armor[1];
                            CurrentArmor.Print();
                            _hasArmor = true;
                            menu3     = "0";
                        }

                        else
                        {
                            Console.WriteLine("Weight limit reached");
                        }
                    }

                    else if (choice2 == "3")
                    {
                        if (checkWeight(_weightFromWeapon, 25))
                        {
                            Console.WriteLine("Equipped Steel armor.");
                            CurrentArmor = _armor[2];
                            CurrentArmor.Print();
                            _hasArmor = true;
                            menu3     = "0";
                        }

                        else
                        {
                            Console.WriteLine("Weight limit reached");
                        }
                    }

                    else if (choice2 == "4")
                    {
                        if (checkWeight(_weightFromWeapon, 40))
                        {
                            Console.WriteLine("Equipped Platnium armor.");
                            CurrentArmor = _armor[3];
                            CurrentArmor.Print();
                            _hasArmor = true;
                            menu3     = "0";
                        }

                        else
                        {
                            Console.WriteLine("Weight limit reached");
                        }
                    }
                }
            }

            else
            {
                Console.WriteLine("There is armor equipped");
            }
        }