Пример #1
0
 /// <summary>
 /// Finds an UltimateCharacterLocomotion and its Inventory and ItemCollection by GameObject name.
 /// If the name is blank, finds the GameObject tagged 'Player'.
 /// </summary>
 public static bool FindCharacterWithInventory(string characterName, out UltimateCharacterLocomotion character, out InventoryBase inventory, out ItemCollection itemCollection)
 {
     inventory      = null;
     itemCollection = null;
     character      = FindCharacter(characterName);
     if (character != null)
     {
         inventory      = character.GetComponent <InventoryBase>();
         itemCollection = UCCUtility.FindItemCollection(character.gameObject);
         if (inventory == null)
         {
             if (DialogueDebug.logWarnings)
             {
                 Debug.LogWarning("Dialogue System: Character '" + character.name + "' doesn't have an Inventory.", character);
             }
         }
         else if (itemCollection == null)
         {
             if (DialogueDebug.logWarnings)
             {
                 Debug.LogWarning("Dialogue System: Character '" + character.name + "' doesn't have access to an Item Set Manager or Item Collection.", character);
             }
         }
     }
     return(character != null && inventory != null && itemCollection != null);
 }
Пример #2
0
        /// <summary>
        /// Finds an ItemType by name in an ItemCollection.
        /// </summary>
        protected static ItemType FindItemType(ItemCollection itemCollection, string itemName)
        {
            if (string.IsNullOrEmpty(itemName))
            {
                if (DialogueDebug.logWarnings)
                {
                    Debug.LogWarning("Dialogue System: Item name is blank.");
                }
                return(null);
            }
            var itemType = UCCUtility.GetItemType(itemCollection, itemName);

            if (itemType == null)
            {
                if (DialogueDebug.logWarnings)
                {
                    Debug.LogWarning("Dialogue System: Item Collection doesn't contain an item type named '" + itemName + "'.");
                }
            }
            return(itemType);
        }