Toilet Simulator
unknown
csharp
2 years ago
18 kB
53
Indexable
//toilet simulator
//main system
using System.Diagnostics;
using System.Dynamic;
using System.Net.Security;
using System.Reflection;
using System.Runtime.CompilerServices;
using Microsoft.VisualBasic;
ToiletSimulator main = new ToiletSimulator();
main.StartToiletSimulator();
Console.ReadKey();
static class Variables{ //Global variables
public static int hungerstat = 5;
public static int hydrationstat = 5;
public static int water = 100;
public static int bread = 5;
public static int sanity = 10;
public static string situation;
public static bool isKnock = false;
public static bool isShout = false;
//timer
public static int hours = 7;
public static int minutes = 0;
public static string timer;
}
#region Menu Region
class ToiletSimulator(){ //main menu
//variables
int choose;
public void StartToiletSimulator(){
Console.Clear();
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("--------------------------------");
Console.WriteLine("Welcome to the Toilet Simulator!");
Console.WriteLine("--------------------------------");
Console.WriteLine("");
Console.WriteLine("(1) Start Game");
Console.WriteLine("(2) Options");
Console.WriteLine("(3) Quit Game");
Console.Write("\nYour Input : ");
try{
choose = Convert.ToInt32(Console.ReadLine());
switch(choose){
case 1:
Console.Clear();
GameMenu gM = new GameMenu();
gM.Gsystem();
break;
case 2:
Console.Clear();
OptionsMenu oM = new OptionsMenu();
oM.oSystem();
break;
case 3:
Environment.Exit(2);
break;
default :
Console.WriteLine("Warning : Input integer in between 1-5 only. \n(PRESS ENTER TO CONTINUE)");
Console.ReadKey();
Console.Clear();
StartToiletSimulator();
break;
}
}
catch(Exception){
Console.WriteLine("Warning : Input integer only.\n(PRESS ENTER TO CONTINUE)");
Console.ReadKey();
Console.Clear();
StartToiletSimulator();
}
}
}
class GameMenu(){ //start game menu
//Stats and items
int hungerstat = Variables.hungerstat;
int hydrationstat = Variables.hydrationstat;
int bread = Variables.bread;
int water = Variables.water;
int sanity = Variables.sanity;
//Time
int hours = Variables.hours;
int minutes = Variables.minutes;
string timer = Variables.timer;
//triggeration
string situation = Variables.situation;
bool isShout = Variables.isShout;
bool isGhostTrigger = false;
bool isGuardTrigger = false;
public void Gsystem(){
if (hungerstat <= 0 || hydrationstat <= 0 || sanity <= 0){
GameOver();
} else{
Time();
Console.WriteLine("----------------");
Console.WriteLine("YOUR STATISTICS");
Console.WriteLine("----------------");
Console.WriteLine("");
Console.WriteLine("Hunger : " + Math.Min(hungerstat,10) + "/10");
Console.WriteLine("Hydration : " + Math.Min(hydrationstat,10) + "/10");
Sanity();
Console.WriteLine("\nToilet System : " + timer + situation);
Console.WriteLine("");
Console.WriteLine("(1) Eat Bread [" + Math.Max(bread,0) + "/5]");
Console.WriteLine("(2) Drink Water [" + Math.Max(water,0) + "%]");
Console.WriteLine("(3) Drawing");
Console.WriteLine("(4) Knock Door");
Console.WriteLine("(5) Shouting");
Console.Write("\nYour Input : ");
try{
int choose = Convert.ToInt32(Console.ReadLine());
switch (choose){
case 1:
Console.Clear();
Hunger();
break;
case 2:
Console.Clear();
Water();
break;
case 3:
Console.Clear();
Draw();
break;
case 4:
Console.Clear();
KnockDoor();
break;
case 5:
Console.Clear();
Shouting();
break;
default :
Console.WriteLine("Warning : Input integer between 1-5 only. \n(PRESS ENTER TO CONTINUE)");
Console.ReadKey();
Console.Clear();
Gsystem();
break;
}
}
catch(Exception){
Console.WriteLine("Warning : Please input the number in between 1-5. \n(PRESS ENTER TO CONTINUE)");
Console.ReadKey();
Console.Clear();
Gsystem();
}
}
void Hunger(){
if (bread > 0){
Console.WriteLine("You ate a bread! \n+5 hunger.");
Console.WriteLine("\nPress Enter to Continue.");
Console.ReadLine();
hungerstat += 5;
bread --;
minutes += 10;
Gsystem();
} else {
Console.WriteLine("You ran out of bread!");
Console.WriteLine("\nPress Enter to Continue.");
Console.ReadLine();
Gsystem();
}
}
void Water(){
if (water > 0){
Console.WriteLine("You drank water! \n+5 hydration.");
Console.WriteLine("\nPress Enter to Continue.");
Console.ReadLine();
hydrationstat += 5;
water -= 10;
minutes += 10;
Gsystem();
} else {
Console.WriteLine("You ran out of water!");
Console.WriteLine("\nPress Enter to Continue.");
Console.ReadLine();
Gsystem();
}
}
void Draw(){
Console.WriteLine("You spent 30mins for drawing!");
Console.WriteLine("You gained +5 sanity! But -5 hydration & -5 hunger.");
Console.WriteLine("\nPress Enter to Continue.");
Console.ReadLine();
sanity += 5;
hydrationstat -= 5;
hungerstat -= 5;
minutes += 30;
Gsystem();
}
void KnockDoor(){
if (isGhostTrigger){
isGhostTrigger = false;
Ghost(true);
minutes += 5;
}
else if(isGuardTrigger){
isGuardTrigger = false;
Guard(true);
minutes += 5;
}else{
Console.WriteLine("Bang! Bang! Bang! You knocked the door.");
Console.WriteLine("nothing happened.");
Console.WriteLine("\nPress Enter to Continue.");
Console.ReadLine();
minutes += 5;
Gsystem();
}
}
void Shouting(){
if (isGhostTrigger){
isGhostTrigger = false;
Ghost(true);
hydrationstat -= 5;
minutes += 5;
}
else if (isGuardTrigger){
isGuardTrigger = false;
Guard(true);
hydrationstat -= 5;
minutes += 5;
}else{
Console.WriteLine("Woii! You shouted.");
Console.WriteLine("-5 hydration.");
Console.WriteLine("\nPress Enter to Continue.");
Console.ReadLine();
hydrationstat -= 5;
minutes += 5;
Gsystem();
}
}
void Time(){
CalculateTime();
if (hours == 7 && minutes == 00){
situation = "0pm... You had been locked in the toilet.";
}
else if (hours == 7 && minutes <= 30){
situation = "pm... You had been locked in the toilet.";
}
else if (hours == 7 && minutes <= 59){
situation = "pm... Try to catch up with sounds.";
}
else if (hours == 8 && minutes == 00){
situation = "0pm... You feel a bit fustrated.";
sanity -= 1;
}
else if (hours == 8 && minutes <= 30){
situation = "pm... You feel a bit frustrated.";
sanity -= 1;
}
else if (hours == 8 && minutes <= 35){
situation = "pm... You heard a faint sound in the distance.";
sanity -= 1;
isGhostTrigger = true;
}else if (hours == 8 && minutes <= 59){
situation = "pm... You heard footsteps outside of your toilet.";
sanity -= 1;
isGhostTrigger = true;
}
else if(hours == 9 && minutes == 00){
situation = "0pm... You heard footsteps again but far... but now you feel a bit panic.";
sanity -= 1;
}
else if (hours == 9 && minutes <= 15){
situation = "pm... The footsteps getting closer and closer.";
sanity -= 1;
isGuardTrigger = true;
}
else if (hours == 9 && minutes <= 30){
situation = "pm... The footsteps stop infront of your toilet.";
isGuardTrigger = true;
}
else if (hours == 9 && minutes <= 45){
situation = "pm... You feel weather getting really cold and uncomfortable.";
sanity -= 1;
}
else if (hours == 9 && minutes <= 59){
situation = "pm... You get a very bad feeling about your situation.";
}
else if (hours == 10){
situation = "pm........";
sanity -= 10;
GameOver();
}
}
void CalculateTime(){
if (minutes >= 60){
minutes = minutes - 60;
hours += 1;
}
timer = hours + "." + minutes;
}
void Ghost(bool isAppear = false){
bool isKnock = Variables.isKnock;
bool isShout = Variables.isKnock;
if(isAppear){
Appear();
}
void Appear(){
Console.Clear();
Console.WriteLine("Is there... anyone inside the toilet?");
Console.WriteLine("\n(1) \"Yes\" \n(2) Stay Silence");
try{
int choose = Convert.ToInt32(Console.ReadLine());
switch(choose){
case 1 :
Console.WriteLine("I see... ");
Thread.Sleep(3000);
Console.WriteLine("System : A head appears on top of the toilet's door.");
Catch();
break;
case 2 :
Console.WriteLine("...");
Console.WriteLine("System : Nothing happens.");
Thread.Sleep(3000);
Disappear();
break;
default :
Console.WriteLine("Warning : Input integer between 1-5 only. \n(PRESS ENTER TO CONTINUE)");
Console.ReadKey();
Console.Clear();
Appear();
break;
}
}
catch(Exception){
Console.WriteLine("Warning : Please input the number in between 1-5. \n(PRESS ENTER TO CONTINUE)");
Console.ReadKey();
Console.Clear();
Appear();
}
}
void Catch(){
Console.WriteLine("System : You have been caught by a shadowy figure.");
Thread.Sleep(5000);
Console.Clear();
GameOver();
}
void Disappear(){
Console.WriteLine("PRESS ENTER TO CONTINUE.");
Console.ReadKey();
Console.Clear();
Gsystem();
}
}
void Sanity(){
if (sanity <= 0){
Console.WriteLine("Sanity : " + Math.Max(sanity,0) + "/10");
}else {
Console.WriteLine("Sanity : " + Math.Min(sanity,10) + "/10");
}
}
void Guard(bool isSpawn = false){
bool isKnock = Variables.isKnock;
bool isShout = Variables.isShout;
if(isSpawn){
Spawn();
}
void Spawn(){
Console.WriteLine("Is there anyone inside?");
Console.WriteLine("\n(1) Reply \"Yes \n(2) Stay Silence");
Console.WriteLine("Your Input : ");
try{
int choose = Convert.ToInt32(Console.ReadLine());
switch(choose){
case 1:
Console.WriteLine("Give me a minutes, I will save you!");
GameWon();
break;
case 2:
Console.WriteLine("...");
Thread.Sleep(3000);
WalkAway();
break;
default:
Console.WriteLine("System: Input integers in between 1-3 only.");
Console.WriteLine("(PRESS ENTER TO CONTINUE)");
Console.ReadLine();
Console.Clear();
Spawn();
break;
}
}
catch(Exception){
Console.WriteLine("Warning: Input integers only.");
Console.WriteLine("(PRESS ENTER TO CONTINUE)");
Console.ReadLine();
Console.Clear();
Spawn();
}
}
void WalkAway(){
}
}
}
public void GameOver(){
ToiletSimulator toiletSimulator = new ToiletSimulator();
Console.Clear();
Console.WriteLine("------------------------------------");
Console.WriteLine("-- YOU LOSE --");
Console.WriteLine("------------------------------------");
Thread.Sleep(3000);
Console.WriteLine("\nPress Enter to return to Main Menu.");
Console.ReadLine();
toiletSimulator.StartToiletSimulator();
}
public void GameWon(){
ToiletSimulator toiletSimulator = new ToiletSimulator();
Thread.Sleep(3000);
Console.Clear();
Console.WriteLine("------------------------------------");
Console.WriteLine("-- YOU WIN!! --");
Console.WriteLine("------------------------------------");
Thread.Sleep(3000);
Console.WriteLine("\nPress Enter to return to Main Menu.");
Console.ReadLine();
toiletSimulator.StartToiletSimulator();
}
}
class OptionsMenu(){ //options menu
//variables
bool isChoose = false;
public void oSystem(){
Console.WriteLine("------------");
Console.WriteLine("Options Menu");
Console.WriteLine("------------");
Console.WriteLine("");
Console.WriteLine("(1) Back To Main Menu");
Console.Write("\nYour Input : ");
int choose = Convert.ToInt32(Console.ReadLine());
ToiletSimulator main = new ToiletSimulator();
if (!isChoose){
if (choose == 1){
isChoose = true;
Console.Clear();
main.StartToiletSimulator();
}else{
isChoose = true;
Console.Clear();
Repeater oR = new Repeater();
oR.optionsR();
}
}
}
}
#endregion
class Repeater(){ //Repeater class
public void optionsR(){
OptionsMenu oR = new OptionsMenu();
oR.oSystem();
}
public void gameR(){
GameMenu gR = new GameMenu();
gR.Gsystem();
}
}
Editor is loading...
Leave a Comment