예제 #1
0
    ///<summary>
    ///Loops through all the interactables in the room, then their internal Interaction components.
    ///The keywords are kind of hard coded into this one, but it shouldn't be a problem.
    ///</summary>
    void PrepareObjects(Room currentRoom)
    {
        for (int i = 0; i < currentRoom.interactableObjectsInRoom.Length; i++)
        {
            string descriptionNotInInventory = interactableItems.GetObjects(currentRoom, i);
            if (descriptionNotInInventory != null)
            {
                interactionDescriptionsInRoom.Add(descriptionNotInInventory);
            }

            InteractableObjects 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);
                }
            }
        }
    }
예제 #2
0
    void PrepareObjects(Room currentRoom)
    {
        foreach (InteractableObject obj in currentRoom.interactableObjectsInRoom)
        {
            string description = interactableItems.GetObjects(obj);
            if (description != null)
            {
                interactableDescriptions.Add(string.Format("{0}{1}</color>", TextColors.GetTag(itemsColor), description));
            }

            foreach (Interaction interaction in obj.interactions)
            {
                if (interaction.inputAction.id == "examine")
                {
                    interactableItems.examineDictionary.Add(obj.noun, interaction.textResponse);
                }

                if (interaction.inputAction.id == "take")
                {
                    interactableItems.takeDictionary.Add(obj.noun, interaction.textResponse);
                }
            }
        }
    }