using System.Collections.Generic;
public List<GameObject> VisibleContent = new List<GameObject>();
public List<GameObject> HiddenContent = new List<GameObject>();
public Room(string name, string ground, string roof, string entrance, List<GameObject> visibleContent, List<GameObject> hiddenContent)
this.Entrance = entrance;
this.VisibleContent = visibleContent;
this.HiddenContent = hiddenContent;
public void HideContent(GameObject obj)
if(!VisibleContent.Contains(obj) && HiddenContent.Contains(obj))
VisibleContent.Remove(obj);
public void ShowContent(GameObject obj)
if(!HiddenContent.Contains(obj) && VisibleContent.Contains(obj))
HiddenContent.Remove(obj);
public GameObject FindHiddenContent(string name)
for(int i = 0; i < HiddenContent.Count; i++)
if(String.Equals(HiddenContent[i].ItemName, name, StringComparison.OrdinalIgnoreCase))
return new GameObject("ERROR", GameObject.ObjectType.Person, GameObject.ItemState.Good, "", "", new List<GameObject>(), new List<GameObject>());
public GameObject FindVisibleContent(string name)
for(int i = 0; i < VisibleContent.Count; i++)
if(String.Equals(VisibleContent[i].ItemName, name, StringComparison.OrdinalIgnoreCase))
return VisibleContent[i];
return new GameObject("ERROR", GameObject.ObjectType.Person, GameObject.ItemState.Good, "", "", new List<GameObject>(), new List<GameObject>());
public ObjectType objType;
public ItemState itemState;
public List<GameObject> unhide;
public List<GameObject> rehide;
public GameObject(string ItemName, ObjectType objType, ItemState itemState, string Text, string ExaminedText, List<GameObject> unhide, List<GameObject> rehide)
this.ItemName = ItemName;
this.itemState = itemState;
this.Examined = ExaminedText;
public static List<Room> rooms = new List<Room>();
public static Room currentRoom;
public static void ProcessInput(string input)
string[] x = input.Split(' ');
GameObject obj = new GameObject("ERROR", GameObject.ObjectType.Person, GameObject.ItemState.Broken, "", "", new List<GameObject>(), new List<GameObject>());
for(int i = 0; i < currentRoom.VisibleContent.Count; i++)
if(String.Equals(currentRoom.VisibleContent[i].ItemName, x[1], StringComparison.OrdinalIgnoreCase))
obj = currentRoom.VisibleContent[i];
if(!String.Equals(x[0], "Say", StringComparison.OrdinalIgnoreCase) && !String.Equals(x[1], "room", StringComparison.OrdinalIgnoreCase))
if(obj.ItemName == "ERROR")
Error("You can't see that.");
string[] keyWords = new string[]
if(String.Equals(x[0], keyWords[0], StringComparison.OrdinalIgnoreCase))
if(obj.objType == GameObject.ObjectType.Place && obj.itemState != GameObject.ItemState.Broken)
else if(String.Equals(x[0], keyWords[1], StringComparison.OrdinalIgnoreCase) && !String.Equals(x[1], "room", StringComparison.OrdinalIgnoreCase))
else if(String.Equals("room", x[1], StringComparison.OrdinalIgnoreCase) && String.Equals(keyWords[1], x[0], StringComparison.OrdinalIgnoreCase))
if(String.Equals(x[2], "Ground", StringComparison.OrdinalIgnoreCase) || String.Equals(x[2], "Floor", StringComparison.OrdinalIgnoreCase))
Speak(currentRoom.Ground);
else if(String.Equals(x[2], "Roof", StringComparison.OrdinalIgnoreCase))
else if(String.Equals(x[2], "Entrance", StringComparison.OrdinalIgnoreCase))
Speak(currentRoom.Entrance);
else if(String.Equals(x[0], keyWords[2], StringComparison.OrdinalIgnoreCase))
if(obj.objType == GameObject.ObjectType.Consumable && obj.itemState != GameObject.ItemState.Broken)
else if(String.Equals(x[0], keyWords[3], StringComparison.OrdinalIgnoreCase))
if(obj.objType == GameObject.ObjectType.Usable && obj.itemState != GameObject.ItemState.Broken)
for(int i = 0; i < obj.unhide.Count; i++)
currentRoom.ShowContent(obj.rehide[i]);
for(int i = 0; i < obj.rehide.Count; i++)
currentRoom.HideContent(obj.rehide[i]);
else if(String.Equals(x[0], keyWords[4], StringComparison.OrdinalIgnoreCase))
if(obj.objType == GameObject.ObjectType.Person && obj.itemState != GameObject.ItemState.Broken)
else if(String.Equals(x[0], keyWords[5], StringComparison.OrdinalIgnoreCase))
for(int i = 1; i < x.Length; i++)
public static void Speak(string text)
Console.WriteLine("> " + text);
public static void Error(string text)
Console.WriteLine("? " + text);
public static void Init()
List<GameObject> emptyList = new List<GameObject>();
rooms.Add(new Room("Start", "A damp stone floor with a checker pattern.", "A wooden roof. It appears to be made out of oak.", "There is no entrance.", emptyList, emptyList));
rooms[0].VisibleContent.Add(new GameObject("Button", GameObject.ObjectType.Usable, GameObject.ItemState.Good, "A door opens across the room.", "A round stone button held in place by a knee height pillar.", emptyList, emptyList));
rooms[0].HiddenContent.Add(new GameObject("Door", GameObject.ObjectType.Place, GameObject.ItemState.Good, "You see a bright white light past the door.", "A rectangular opening in the wall", emptyList, emptyList));
rooms[0].HiddenContent.Add(new GameObject("Light", GameObject.ObjectType.Place, GameObject.ItemState.Good, "The light consumes you, and you fall into a pit. An elderly man sites at the other side of the pit.", "A bright white light inside the door", emptyList, emptyList));
rooms[0].VisibleContent[0].unhide = new List<GameObject>() { rooms[0].HiddenContent[0] };
rooms[0].HiddenContent[0].unhide = new List<GameObject>() { rooms[0].HiddenContent[1] };
public static void Help()
Speak("To interect with the world, type in a command and the name of the object you wish to interect with. (Ex. Activate button)");
Speak("To activate an object, type activate (Ex. Activate lever)");
Speak("To go to an object, type enter (Ex. Enter door)");
Speak("To speak with someone, type talk (Ex. Talk man)");
Speak("To examine an object, type examine (Ex. Examine corpse)");
Speak("To use an object in your inventory, type use (Ex. Use potion)");
public static void Main()
Speak("A button lays on a wall infront of you.");
string x = Console.ReadLine();
if(String.Equals(x, "Help", StringComparison.OrdinalIgnoreCase))