public static void BuySellYN(int val, ref bool action, int buySell, Player_Stats player) { int choice; string purchaseSell; if (buySell == 1) { purchaseSell = "Purchase"; } //says buy if buying else { purchaseSell = "Sell"; } // says sell if selling Console.WriteLine($"1. {purchaseSell}"); Console.WriteLine("2. Decline"); choice = GetInt(2); switch (choice) { case 1: if (buySell == 1) { if (player.SMoney() < val) { Console.WriteLine("You don't have enough money."); action = false; break; } else { player.ChangeMoney(-val); action = true; break; } } else { player.ChangeMoney(val); action = true; break; } case 2: Console.WriteLine("Well maybe another time."); action = false; break; default: Console.WriteLine("Uh... ok, well see you later..."); action = false; break; } return; }
public static bool CheckGameOver(Ship myShip, Travel myUniverse, Player_Stats player) { int counter = 0; bool hasCargo = false; bool enoughFuel = false; do { if (myShip.inventory[counter, 1] == 0) { hasCargo = false; counter++; } else { hasCargo = true; counter = myShip.CargoSlots(); } }while (counter < myShip.CargoSlots()); myUniverse.WhereCanMove(myShip, ref enoughFuel, false); if (player.SYears() >= 40) { Console.WriteLine("After long years trading you've gotten too old to for this and retire."); return(true); } else if (player.SMoney() == 0 && hasCargo == false) { return(true); } else if ((player.SMoney() <= 4) && enoughFuel == false) { return(true); } return(false); }