//This method occurs every time the ThePlayer loses, it takes out the Wagered amount from the ThePlayer's //Money and checks if they have enough Money to keep playing. public void ThePlayerLost() { ThePlayer p = new ThePlayer(); ThePlayer.Money -= ThePlayer.Wager; //the new money amount =money amount-money lost Console.WriteLine($"You lost, you now have ${ThePlayer.Money} left."); Console.WriteLine("Press enter..."); if (ThePlayer.Money <= 0) //if statement to control if user can keep playing with funds { Console.WriteLine("No cash!\nTry again..."); Console.ReadLine(); p.StartGame(); } }
//number bet, checks if the specific number the ThePlayer is betting on gets called public void Number() { ThePlayer p = new ThePlayer(); PickBet b = new PickBet(); if (b.binChoice == wa.BallFalls) //this by some real luck the ball lands in the bin, user bet multipled by 35 { ThePlayer.Money += (ThePlayer.Wager * 35); Console.WriteLine($"You won ${ThePlayer.Wager * 35}!"); } else { ThePlayerLost(); } }
static void Main() { ThePlayer thePlayer = new ThePlayer(); DisplayMenu displayMenu = new DisplayMenu(); try { thePlayer.StartGame(); Console.ReadLine(); } catch (Exception e) { Console.WriteLine(e); } }
//This method checks to see if the ThePlayer has enough Money to bet public void Bet() { try { ThePlayer p = new ThePlayer(); Console.WriteLine("How much do you bet?"); Console.Write(":>"); ThePlayer.Wager = Convert.ToInt32(Console.ReadLine()); while (ThePlayer.Wager > ThePlayer.Money) { Console.WriteLine("You're trying to bet more than what you have!"); Console.WriteLine("Try again:"); Console.Write(":>"); ThePlayer.Wager = Convert.ToInt32(Console.ReadLine()); } } catch (Exception e) { Console.WriteLine(e); } }