Question by
josereidenvach1999 · Mar 30, 2020 at 10:13 PM ·
c#textprogramming
How can I add an article to a noun in this C# code?
So I'm trying to make a text adventure game. I've been following an official unity tutorial. The problem is, I speak spanish, so I have masculine and femenine nouns and articles. In english, you can perform the action of taking a hammer or a key without problem. But, in spanish, tomar un martillo o tomar una llave aren't the same. "You took the hammer" or "you took the key" is consistent and understandable. While, "tomaste EL martillo" y "tomaste LA llave" requieres different pronouns. How can I program the game to make those differences? Thanks in advance!
This is my code sheet:
using System.Collections; using System.Collections.Generic; using UnityEngine;
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 ("Te diriges hacia el " + directionNoun + ".");
controller.DisplayRoomText();
} else
{
controller.LogStringWithReturn("No hay camino hacia el " + directionNoun + ".");
}
}
public void ClearExits ()
{
exitDictionary.Clear ();
}
}
Comment