コード例 #1
0
        //Planet Crystal
        public void calAddDiamond(Character character)
        {
            try
            {
                double diamond = 1000;
                Console.WriteLine("How many do you want to buy?");
                double n = double.Parse(Console.ReadLine());
                if (character.Storage.Coin < diamond * n)
                {
                    Console.WriteLine("Insuficient Funds you cannot buy this item. Please choose a different item.\n Press Enter to continue");
                    Console.ReadLine();
                    Console.Clear();
                    p.marketCrystal();
                }

                else
                {
                    character.Storage.Coin -= n * diamond;
                }
                character.Storage.Diamond += n;
                Console.WriteLine($"You now have {character.Storage.Coin} coins.");
                Console.WriteLine($"You now have {character.Storage.Diamond} Diamond");
                Console.ReadLine();
            }
            catch (Exception)
            {
                Console.WriteLine("Wrong input use numbers");
                calAddDiamond(character);
            }
        }
コード例 #2
0
 public void Crystal()
 {
     Console.WriteLine("Welcome to CRYSTAL!!!");
     Console.WriteLine("---------------------\nPress Enter to continue");
     Console.ReadLine();
     Console.WriteLine($"Your health is at {character.Storage.Health -= 15}%");
     Console.WriteLine($"Your fuel is at {character.Storage.Fuel -= 25}%");
     Console.WriteLine($"You have {character.Storage.Coin} coins\nPress Enter to Continue.");
     Console.ReadLine();
     Console.Clear();
     p.marketCrystal();
 }