Text Adventure help!
So I'm following an official tutorial on how to make a text adventure game. The thing is, functions like "take" o "examine" allow me to write an answer, such as: "you take the hammer. Cool". But the "Go" function, only allows me to code a predetermined answer: "You head off to the north". I can't change it to match each individual exit on my room. What if want the chararcter not to "head off to the stairs" but to "head up the stairs"? This is my first time working with C#. Sorry for my bad english, I speak spanish! Again, I'd like to be able to write an individual answer for every exit in Unity's interface, just like I do with the "take" or "examine" function. This is the code sheet where my "go" response is.
public class RoomNavigation : MonoBehaviour {
public Room currentRoom;
Dictionary<string, Room> exitDictionary = new Dictionary<string, Room> ();
GameController controller;
void Awake()
{
controller = GetComponent<GameController> ();
}
public void UnpackExitsInRoom()
{
for (int i = 0; i < currentRoom.exits.Length; i++)
{
exitDictionary.Add(currentRoom.exits[i].keyString, currentRoom.exits[i].valueRoom);
controller.interactionDescriptionsInRoom.Add(currentRoom.exits[i].exitDescription);
}
}
public void AttemptToChangeRooms(string directionNoun)
{
if (exitDictionary.ContainsKey(directionNoun)) {
currentRoom = exitDictionary[directionNoun];
controller.LogStringWithReturn ("you head off to the " + directionNoun + ".");
controller.DisplayRoomText();
} else
{
controller.LogStringWithReturn("You head off to the " + directionNoun + ".");
}
}
public void ClearExits ()
{
exitDictionary.Clear ();
}
}