public static void WarpTo(Planet currentplanet, Planet toPlanet, Ship playership, Inventory player) { TravelTime(Planet.Distance(currentplanet, toPlanet), playership, player); double fuelused = Planet.Distance(currentplanet, toPlanet); playership.CurrentFuel -= fuelused; Console.WriteLine("You use up {0:F2} fuel", fuelused); Console.WriteLine("Press ENTER to continue."); Console.ReadLine(); Time.TimePassed(player, playership); travTime = 0; }
public static void MainMenu(Ship Ship, Inventory inventory, List <Planet> planetlist) { Planet currentplanet = new Planet(0, 0, "Earth", "Earthish"); do { Console.Clear(); Console.WriteLine("You are in your ship orbiting {0}", currentplanet.planetName); Console.WriteLine("\nYou can go to the Trade Post, Travel, Inventory, or Exit"); string input = Console.ReadLine(); if (input.ToLower() == "trade post") { PlanetTP.TradingPost(inventory, Ship, currentplanet); } else if (input.ToLower() == "travel") { Console.WriteLine("Where would you like to warp to? Enter the planet name or leave to exit"); foreach (var planetf in planetlist) { if (Planet.Distance(currentplanet, planetf) < Ship.CurrentFuel && Planet.Distance(currentplanet, planetf) != 0) { Console.WriteLine("{0} Economy: {1} :{2:F2} Light years away", planetf.planetName, planetf.biome, Planet.Distance(currentplanet, planetf)); } } bool properinput = false; do { var planetinput = Console.ReadLine(); foreach (var planetf in planetlist) { if (planetinput.ToLower() == planetf.planetName.ToLower() && Ship.CurrentFuel >= Planet.Distance(currentplanet, planetf)) { Warp.WarpTo(currentplanet, planetf, Ship, inventory); currentplanet = planetf; properinput = true; } } if (planetinput.ToLower() == "leave") { properinput = true; } else if (properinput == false) { Console.WriteLine("Not enough fuel or invalid input, please try again."); Console.WriteLine("Press ENTER to continue"); Console.ReadLine(); } } while (properinput == false); } else if (input.ToLower() == "inventory") { Inventory.CheckInventory(Ship, inventory); } else if (input.ToLower() == "exit") { Console.WriteLine("Leaving already? See ya next time. Bye"); Console.ReadLine(); exitChoice = true; } } while (exitChoice == false); }