示例#1
0
        /// <summary>
        /// Initializes the default values.
        /// </summary>
        /// <param name="gameObject">The GameObject this object is attached to.</param>
        /// <param name="itemSetManager">The ItemSetManager which owns the ItemSet.</param>
        /// <param name="categoryID">The ID of the category that the ItemSet belongs to.</param>
        /// <param name="categoryIndex">The index of the category that the ItemSet belongs to.</param>
        /// <param name="index">The index of the ItemSet.</param>
        public void Initialize(GameObject gameObject, ItemSetManagerBase itemSetManager, uint categoryID, int categoryIndex, int index)
        {
            // The ItemSet may have already been initialized.
            if (m_ItemSetManager != null)
            {
                return;
            }

            base.Initialize(gameObject);

            m_ItemSetManager = itemSetManager;
            var toggleEquipAbilities = gameObject.GetCachedComponent <UltimateCharacterLocomotion>().GetAbilities <ToggleEquip>();

            if (toggleEquipAbilities != null)
            {
                for (int i = 0; i < toggleEquipAbilities.Length; ++i)
                {
                    if (toggleEquipAbilities[i].ItemSetCategoryID == categoryID)
                    {
                        m_ToggleEquip = toggleEquipAbilities[i];
                        break;
                    }
                }
            }
            var equipUnequipAbilities = gameObject.GetCachedComponent <UltimateCharacterLocomotion>().GetAbilities <EquipUnequip>();

            if (equipUnequipAbilities != null)
            {
                for (int i = 0; i < equipUnequipAbilities.Length; ++i)
                {
                    if (equipUnequipAbilities[i].ItemSetCategoryID == categoryID)
                    {
                        m_EquipUnequip = equipUnequipAbilities[i];
                        break;
                    }
                }
            }
            m_CategoryIndex = categoryIndex;
            m_Index         = index;
            if (m_ItemIdentifiers == null)
            {
                m_ItemIdentifiers = new IItemIdentifier[m_Slots.Length];
            }
        }
示例#2
0
        /// <summary>
        /// Initializes the default values.
        /// </summary>
        /// <param name="gameObject">The GameObject this object is attached to.</param>
        /// <param name="itemSetManager">The ItemSetManager which owns the ItemSet.</param>
        /// <param name="categoryID">The ID of the category that the ItemSet belongs to.</param>
        /// <param name="categoryIndex">The index of the category that the ItemSet belongs to.</param>
        /// <param name="index">The index of the ItemSet.</param>
        public void Initialize(GameObject gameObject, ItemSetManagerBase itemSetManager, uint categoryID, int categoryIndex, int index)
        {
            // The ItemSet may have already been initialized.
            if (m_ItemSetManager != null)
            {
                return;
            }

            base.Initialize(gameObject);

            m_ItemSetManager = itemSetManager;
            var equipUnequipAbilities = gameObject.GetCachedComponent <UltimateCharacterLocomotion>().GetAbilities <EquipUnequip>();

            if (equipUnequipAbilities != null)
            {
                for (int i = 0; i < equipUnequipAbilities.Length; ++i)
                {
                    if (equipUnequipAbilities[i].ItemSetCategoryID == categoryID)
                    {
                        m_EquipUnequip = equipUnequipAbilities[i];
                        break;
                    }
                }
            }
            m_CategoryIndex = categoryIndex;
            m_Index         = index;
            if (m_ItemIdentifiers == null)
            {
                m_ItemIdentifiers = new IItemIdentifier[m_Slots.Length];
            }
            m_EmptyItemSet = true;
            for (int i = 0; i < m_Slots.Length; ++i)
            {
                if (m_Slots[i] != null)
                {
                    m_EmptyItemSet = false;
                    return;
                }
            }

            EventHandler.RegisterEvent <int, int>(m_ItemSetManager.gameObject, "OnItemSetManagerUpdateItemSet", OnUpdateItemSet);
        }