private void PrepareObjectsToTakeOrExamine(GameArea currentArea) { for (int i = 0; i < currentArea.interactableObjectsInArea.Length; i++) { string descriptionNotInInventory = interactableItems.GetObjectsNotInInventory(currentArea, i); if (descriptionNotInInventory != null) { areaInteractionDescription.Add(descriptionNotInInventory); } InteractableObjects interactableInArea = currentArea.interactableObjectsInArea[i]; for (int j = 0; j < interactableInArea.interactions.Length; j++) { Interaction interaction = interactableInArea.interactions[j]; if (interaction.inputAction.keyWord == "examine") { interactableItems.examineDictionary.Add(interactableInArea.noun, interaction.textResponse); } if (interaction.inputAction.keyWord == "take") { interactableItems.takeDictionary.Add(interactableInArea.noun, interaction.textResponse); } } } }
void PrepareObjectToTakeOrExamine(Room currentRoom) { for (int i = 0; i < currentRoom.interactableObjectsInRoom.Length; i++) { string descriptionNotInInventory = interactableItems.GetObjectsNotInInventory(currentRoom, i); if (descriptionNotInInventory != null) { interactionDescriptionsInRoom.Add(descriptionNotInInventory); } InteractableObject interactableInRoom = currentRoom.interactableObjectsInRoom [i]; for (int j = 0; j < interactableInRoom.interactions.Length; j++) { Interaction interaction = interactableInRoom.interactions [j]; if (interaction.inputAction.keyWord == "examine") { interactableItems.examineDictionary.Add(interactableInRoom.noun, interaction.textResponse); } if (interaction.inputAction.keyWord == "take") { interactableItems.takeDictionary.Add(interactableInRoom.noun, interaction.textResponse); } } } }
void PrepareObjectsToInteract(Room currentRoom) { for (int i = 0; i < currentRoom.interactableObjectsInRoom.Length; i++) { //Add the item descriptions to the display dictionary if they aren't in already string descriptionNotInInventory = interactableItems.GetObjectsNotInInventory(currentRoom, i); if (descriptionNotInInventory != null) { interactionDescriptionsInRoom.Add(descriptionNotInInventory); } InteractableObject interactableInRoom = currentRoom.interactableObjectsInRoom [i]; for (int j = 0; j < interactableInRoom.interactions.Length; j++) { Interaction interaction = interactableInRoom.interactions[j]; if (interaction.inputAction.keyWords.Contains("examine")) { interactableItems.examineDictionary.Add(interactableInRoom.noun, interaction.textResponse); //Examine Item(Connect to Text response) (Script: Interaction) } if (interaction.inputAction.keyWords.Contains("take")) { interactableItems.takeDictionary.Add(interactableInRoom.noun, interaction.textResponse); //take Item(Connect to Text response) (Script: Interaction) } } } interactableItems.AddActionResponsesToUseDictionary(); }
void PrepareObjectsToTakeOrExamine(Room currentRoom) { for (int i = 0; i < currentRoom.interactableObjectsInRoom.Length; i++) { /*If the objects are not in the players inventory it will return the description to the list of interactables*/ string descriptionNotInInventory = interactableItems.GetObjectsNotInInventory(currentRoom, i); if (descriptionNotInInventory != null) { interactionDescriptionsInRoom.Add(descriptionNotInInventory); } InteractableObject interactableInRoom = currentRoom.interactableObjectsInRoom[i]; for (int j = 0; j < interactableInRoom.interactions.Length; j++) { /*If the users text input contains examine, it will do the if*/ Interaction interaction = interactableInRoom.interactions[j]; if (interaction.inputAction.keyWord == "examine") { /*Adds the item to the interactable examine dictionary and gives a text response*/ interactableItems.examineDictionary.Add(interactableInRoom.noun, interaction.textResponse); } if (interaction.inputAction.keyWord == "take") { /*Adds the item to the interactable take dictionary and gives a text response*/ interactableItems.takeDictionary.Add(interactableInRoom.noun, interaction.textResponse); } } } }
// Check if objects in room are not in inventory already void PreparedObjectsToTakeOrExamine(Room current) { foreach (InteractableObject interactableInRoom in current.interactableObjectsInRoom) { string descriptionNotInInventory = interactableItems.GetObjectsNotInInventory(interactableInRoom); if (descriptionNotInInventory != null) { interactionDescriptionsInRoom.Add(descriptionNotInInventory); } // each object is passive of some specific interaction types foreach (Interaction interaction in interactableInRoom.interactions) { // so if the obj has that interaction type, add its noun and response // for safety we can lower case the keyword if it was mispelled w higher case letter if (interaction.inputAction.keyWord == "examine") { interactableItems.examineDictionary.Add(interactableInRoom.noun, interaction.textResponse); } if (interaction.inputAction.keyWord == "take") { interactableItems.takeDictionary.Add(interactableInRoom.noun, interaction.textResponse); } } } }
private void PrepareObjectsToTakeOrExamineOrTalk(Place currentPlace) { for (int i = 0; i < currentPlace.interactableObjectsInPlace.Length; i++) { string descriptionNotInInventory = interactableObjects.GetObjectsNotInInventory(currentPlace, i); if (descriptionNotInInventory != null) { interactionDescriptionsInPlace.Add(descriptionNotInInventory); } InteractableObject interactableInPlace = currentPlace.interactableObjectsInPlace[i]; for (int j = 0; j < interactableInPlace.interactions.Length; j++) { Interaction interaction = interactableInPlace.interactions[j]; if (interaction.inputAction.keyWord == "examine") { interactableObjects.examineDictionary.Add(interactableInPlace.noun, interaction.textResponse); interactableObjects.examineImageDictionary.Add(interactableInPlace.noun, interaction.textureResponse); } if (interaction.inputAction.keyWord == "take") { interactableObjects.takeDictionary.Add(interactableInPlace.noun, interaction.textResponse); } if (interaction.inputAction.keyWord == "talkto") { interactableObjects.talkDictionary.Add(interactableInPlace.noun, interaction.textResponse); interactableObjects.talkDialogDictionary.Add(interactableInPlace.noun, interactableInPlace.sentences); } } } }
void PrepareObjectsToTakeOrExamine(Room currentRoom) { for (int i = 0; i < currentRoom.objectsInRoom.Length; i++) { string descriptionNotInInventory = interactableItems.GetObjectsNotInInventory(currentRoom, i); if (descriptionNotInInventory != null) { interactionDescriptionsInTheRoom.Add(descriptionNotInInventory); } } }
void PrepareObjectsToTakeOrExamine(Room currentRoom) { for (int i = 0; i < currentRoom.interactableObjectsInRoom.Length; i++) { //go over the array of objects in the room to display their descriptions //get reference to InteractableItems script string descriptionNotInInventory = interactableItems.GetObjectsNotInInventory(currentRoom, i); if (descriptionNotInInventory != null) { //if loop succeeded and something WAS found inside of the room interactionDescriptionsInRoom.Add(descriptionNotInInventory); } InteractableObject interactableInRoom = currentRoom.interactableObjectsInRoom[i]; for (int j = 0; j < interactableInRoom.interactions.Length; j++) { //first loop gets all the interactabe objects. //Second loop --> on each object, loop over its individual interactions (examine, take, use) Interaction interaction = interactableInRoom.interactions[j]; //Interactions are JUST the names and descriptions of the objects in the room. //This isn't what you want to remove if (interaction.inputAction.keyWord == "examine") { //if the player types the examine keyword... //add it to examine dictionary. For example, if you pass in "Key", return the text response for it. interactableItems.examineDictionary.Add(interactableInRoom.noun, interaction.textResponse); } if (interaction.inputAction.keyWord == "take" && !interactableInRoom.canNotTake) { //Debug.Log("Took an item, delete it from the room's list"); //if the player types the take keyword... //add it to take dictionary //Remember, the takeDictionary IS your Inventory Dictionary! interactableItems.takeDictionary.Add(interactableInRoom.noun, interaction.textResponse); } if (interaction.inputAction.keyWord == "use" && !interactableItems.useDictionaryResponse.ContainsKey(interactableInRoom.noun)) //this is the error line. don't add to the dictionary if its already in it { interactableItems.useDictionaryResponse.Add(interactableInRoom.noun, interaction.textResponse); //delete item from room interactableobjects array/list } } } }
/// <summary> /// Prepares objects inside the room for interacting, taking, examining, etc... /// </summary> /// <param name="currentRoom"></param> private void PrepareObjects(Room currentRoom) { for (int i = 0; i < currentRoom.interactableObjects.Length; i++) { // If it doesn't find object not in inventory, stores description string descriptionNotInInventory = interactableItems.GetObjectsNotInInventory(currentRoom, i); // If not null if (descriptionNotInInventory != null) { // Stores descriptions into the list interactionDescrptionsInRoom.Add(descriptionNotInInventory); } // Add interactable object InteractableObject interactableInRoom = currentRoom.interactableObjects[i]; // Iterates through the interactables in the room for (int j = 0; j < interactableInRoom.interactions.Length; j++) { // stores the current interation at [j] Interaction interaction = interactableInRoom.interactions[j]; // If the player types in examine if (interaction.inputAction.Keyword == "examine") { // Stores interactable into the dict interactableItems.examineDictionary.Add(interactableInRoom.noun, interaction.textResponse); } // If the player types in take if (interaction.inputAction.Keyword == "take") { // Stores interactable into the dict interactableItems.takeDictionary.Add(interactableInRoom.noun, interaction.textResponse); } } } }
void PrepareObjectsToTakeOrExamine(Room currentRoom) { foreach (InteractableObject interactableObject in currentRoom.interactableObjects) { string descriptionNotInInventory = interactableItems.GetObjectsNotInInventory(currentRoom, interactableObject); if (descriptionNotInInventory != null) { interactionDescriptionsInRoom.Add(descriptionNotInInventory); } foreach (Interaction interaction in interactableObject.interactions) { if (interaction.inputAction.keyword == "examine") { interactableItems.examineDict.Add(interactableObject.identifier, interaction.textResponse); } else if (interaction.inputAction.keyword == "take") { interactableItems.takeDict.Add(interactableObject.identifier, interaction.textResponse); } } } }
void PrepareObjectsToTakeOrExamine(Room currentRoom) { for (int i = 0; i < currentRoom.interactableObjectsInRoom.Length; i++) { string descriptionNotInInventory = interactableItems.GetObjectsNotInInventory(currentRoom, i); if (descriptionNotInInventory != null) { interactionDescriptionsInRoom.Add(descriptionNotInInventory); } InteractableObject interactableInRoom = currentRoom.interactableObjectsInRoom [i]; for (int j = 0; j < interactableInRoom.interactions.Length; j++) { Interaction interaction = interactableInRoom.interactions [j]; if (interaction.inputAction.keyWord == "examine" && !(interactableItems.nounsInInventory.Contains(interactableInRoom.noun)) && !(interactableInRoom.removeItem)) { interactableItems.examineDictionary.Add(interactableInRoom.noun, interaction.currentTextResponse); } if (interaction.inputAction.keyWord == "take") { interactableItems.takeDictionary.Add(interactableInRoom.noun, interaction.currentTextResponse); } Debug.Log("Checking for Find"); if (interaction.inputAction.keyWord == "find") { Debug.Log("Find is found"); Debug.Log(interactableInRoom.noun); Debug.Log(interaction.currentTextResponse); interactableItems.findDictionary.Add(interactableInRoom.noun, interaction.currentTextResponse); } } } }