コード例 #1
0
        public void Status(Travel myUniverse, Ship myShip)
        {
            Console.WriteLine($"You are on {myUniverse.GetPlanetName(myUniverse.planetNum)}.");
            Console.WriteLine("You have been traveling for:");
            Console.WriteLine($"Years:{years}");
            Console.WriteLine($"Weeks:{weeks}");
            Console.WriteLine($"Days:{days}");
            Console.WriteLine($"Hours:{hours}\n");

            Console.WriteLine($"You traveled {distance} lightyears!\n");

            Console.WriteLine($"You have {money} credits.\n");
            if (money > 100)
            {
                Console.WriteLine($"You have gained {money - 100} credits.");
            }
            else if (money < 100)
            {
                Console.WriteLine($"You have lost {100 - money} credits.");
            }
            else
            {
                Console.WriteLine($"You are breaking even.");
            }
            Console.WriteLine($"Your ship has {myShip.Fuel()} fuel in a fuel container that can hold {myShip.FuelTank()} units of fuel.");
            Console.WriteLine($"It hase a max speed of warp {myShip.Speed()}.");
            Console.WriteLine($"And it has {myShip.CargoSlots()} slots of cargo space that hold {myShip.SlotSize()} units of cargo.\n");
            Console.WriteLine("Inside of which is:");
            Utility.ShowCargoInv(myShip);

            return;
        }
コード例 #2
0
        public void NewTrade(Travel myUniverse, Player_Stats player, Ship myShip)
        {
            bool   isDone = false;
            string input  = "";

            Console.WriteLine($"Welcome to {myUniverse.GetPlanetName(myUniverse.planetNum)}.");
            Console.WriteLine($"Here is what we have.\n");
            PlanetInv(prices);
            do
            {
                Console.WriteLine("Would you like to buy or sell? Please type buy or sell for selection.");
                Console.WriteLine("If you would like to leave press \"Enter\".");
                input = Console.ReadLine();
                if (input == "")
                {
                    isDone = true;
                }
                else if (input == "Buy" || input == "buy")
                {
                    BuyThings(myShip, player, myUniverse); //Calls the methomakepricesd for buying
                }
                else if (input == "Sell" || input == "sell")
                {
                    SellThings(player, myShip);
                }
                else
                {
                    Console.WriteLine("I don't understand.");
                }
            }while (!isDone);
            Console.WriteLine("Good Luck!");
            return;
        }