Exemple #1
0
        //check if player is on the vendor
        //if so, make the screen go to shop
        //handle enter and exit from the shop
        public static void EnterShop()
        {
            SoundManager.VendorSound();
            inShop = true;
            while (inShop == true)
            {
                Console.Clear();
                Hud.PrintHUD();
                ShopText();
                switch (Console.ReadKey().Key)
                {
                case ConsoleKey.X:
                    inShop = false;
                    Console.Clear();
                    break;

                case ConsoleKey.D1:
                    if (PlayerStats.hasSword != true)
                    {
                        if (PlayerStats.gold >= ItemManager.Sword.buyPrice)
                        {
                            SoundManager.PerchaseSound();
                            Vendor.BuySword();
                        }
                        else
                        {
                            Hud.InfoText2 = "Not Enough Resources to complete Purchase";
                        }
                    }
                    else
                    {
                        if (PlayerStats.gold >= ItemManager.Sword.upgradeGoldPrice && PlayerStats.leather >= ItemManager.Sword.upgradeLeatherPrice)
                        {
                            SoundManager.PerchaseSound();
                            Vendor.UpgradeSword();
                        }
                        else
                        {
                            Hud.InfoText2 = "Not Enough Resources to complete Purchase";
                        }
                    }
                    break;

                case ConsoleKey.D2:
                    if (PlayerStats.hasBow != true)
                    {
                        if (PlayerStats.gold >= ItemManager.Bow.buyPrice)
                        {
                            SoundManager.PerchaseSound();
                            Vendor.BuyBow();
                        }
                        else
                        {
                            Hud.InfoText2 = "Not Enough Resources to complete Purchase";
                        }
                    }
                    else
                    {
                        if (PlayerStats.gold >= ItemManager.Bow.upgradeGoldPrice && PlayerStats.leather >= ItemManager.Bow.upgradeLeatherPrice)
                        {
                            SoundManager.PerchaseSound();
                            Vendor.UpgradeBow();
                        }
                        else
                        {
                            Hud.InfoText2 = "Not Enough Resources to complete Purchase";
                        }
                    }
                    break;

                case ConsoleKey.D3:
                    if (PlayerStats.hasHelmet != true)
                    {
                        if (PlayerStats.gold >= ItemManager.Helmet.buyPrice)
                        {
                            SoundManager.PerchaseSound();
                            Vendor.BuyHelmet();
                        }
                        else
                        {
                            Hud.InfoText2 = "Not Enough Resources to complete Purchase";
                        }
                    }
                    else
                    {
                        if (PlayerStats.gold >= ItemManager.Helmet.upgradeGoldPrice && PlayerStats.leather >= ItemManager.Helmet.upgradeLeatherPrice)
                        {
                            SoundManager.PerchaseSound();
                            Vendor.UpgradeHelmet();
                        }
                        else
                        {
                            Hud.InfoText2 = "Not Enough Resources to complete Purchase";
                        }
                    }
                    break;

                case ConsoleKey.D4:
                    if (PlayerStats.hasChestPlate != true)
                    {
                        if (PlayerStats.gold >= ItemManager.ChestPlate.buyPrice)
                        {
                            SoundManager.PerchaseSound();
                            Vendor.BuyChestPlate();
                        }
                        else
                        {
                            Hud.InfoText2 = "Not Enough Resources to complete Purchase";
                        }
                    }
                    else
                    {
                        if (PlayerStats.gold >= ItemManager.ChestPlate.upgradeGoldPrice && PlayerStats.leather >= ItemManager.ChestPlate.upgradeLeatherPrice)
                        {
                            SoundManager.PerchaseSound();
                            Vendor.UpgradeChestPlate();
                        }
                        else
                        {
                            Hud.InfoText2 = "Not Enough Resources to complete Purchase";
                        }
                    }
                    break;

                case ConsoleKey.D5:
                    if (PlayerStats.hasArmBracers != true)
                    {
                        if (PlayerStats.gold >= ItemManager.ArmBracers.buyPrice)
                        {
                            SoundManager.PerchaseSound();
                            Vendor.BuyArmBracers();
                        }
                        else
                        {
                            Hud.InfoText2 = "Not Enough Resources to complete Purchase";
                        }
                    }
                    else
                    {
                        if (PlayerStats.gold >= ItemManager.ArmBracers.upgradeGoldPrice && PlayerStats.leather >= ItemManager.ArmBracers.upgradeLeatherPrice)
                        {
                            SoundManager.PerchaseSound();
                            Vendor.UpgradeArmBracers();
                        }
                        else
                        {
                            Hud.InfoText2 = "Not Enough Resources to complete Purchase";
                        }
                    }
                    break;

                case ConsoleKey.D6:
                    if (PlayerStats.hasBoots != true)
                    {
                        if (PlayerStats.gold >= ItemManager.Boots.buyPrice)
                        {
                            SoundManager.PerchaseSound();
                            Vendor.BuyBoots();
                        }
                        else
                        {
                            Hud.InfoText2 = "Not Enough Resources to complete Purchase";
                        }
                    }
                    else
                    {
                        if (PlayerStats.gold >= ItemManager.Boots.upgradeGoldPrice && PlayerStats.leather >= ItemManager.Boots.upgradeLeatherPrice)
                        {
                            SoundManager.PerchaseSound();
                            Vendor.UpgradeBoots();
                        }
                        else
                        {
                            Hud.InfoText2 = "Not Enough Resources to complete Purchase";
                        }
                    }
                    break;

                case ConsoleKey.D7:
                    if (PlayerStats.hasGuntlet != true)
                    {
                        if (PlayerStats.gold >= ItemManager.Guntlet.buyPrice)
                        {
                            SoundManager.PerchaseSound();
                            Vendor.BuyGuntlet();
                        }
                        else
                        {
                            Hud.InfoText2 = "Not Enough Resources to complete Purchase";
                        }
                    }
                    else
                    {
                        if (PlayerStats.gold >= ItemManager.Guntlet.upgradeGoldPrice && PlayerStats.leather >= ItemManager.Guntlet.upgradeLeatherPrice)
                        {
                            SoundManager.PerchaseSound();
                            Vendor.UpgradeGuntlet();
                        }
                        else
                        {
                            Hud.InfoText2 = "Not Enough Resources to complete Purchase";
                        }
                    }
                    break;

                case ConsoleKey.D8:
                {
                    if (PlayerStats.gold >= Vendor.refillHPCost)
                    {
                        SoundManager.PerchaseSound();
                        Vendor.RefillHP();
                    }
                    else
                    {
                        Hud.InfoText2 = "Not Enough Resources to complete Purchase";
                    }
                }
                break;

                case ConsoleKey.D9:
                {
                    if (PlayerStats.gold >= Vendor.increaceMaxHPCost)
                    {
                        SoundManager.PerchaseSound();
                        Vendor.IncreaceMaxHP();
                    }
                    else
                    {
                        Hud.InfoText2 = "Not Enough Resources to complete Purchase";
                    }
                }
                break;
                }
            }
        }