Esempio n. 1
0
 /// <summary>
 ///     Custom item created as an "empty" primitive.<br />
 ///     At least the name and the Icon of the <see cref="global::ItemDrop"/> must be edited after creation.
 /// </summary>
 /// <param name="name">Name of the new prefab. Must be unique.</param>
 /// <param name="addZNetView">If true a ZNetView component will be added to the prefab for network sync.</param>
 public CustomItem(string name, bool addZNetView)
 {
     ItemPrefab = PrefabManager.Instance.CreateEmptyPrefab(name, addZNetView);
     ItemDrop   = ItemPrefab.AddComponent <ItemDrop>();
     ItemDrop.m_itemData.m_shared        = new ItemDrop.ItemData.SharedData();
     ItemDrop.m_itemData.m_shared.m_name = name;
 }
Esempio n. 2
0
        /// <summary>
        ///     Custom item created as an "empty" primitive with a <see cref="global::Recipe"/> made from a <see cref="ItemConfig"/>.<br />
        ///     At least the name and the Icon of the <see cref="global::ItemDrop"/> must be edited after creation.
        /// </summary>
        /// <param name="name">Name of the new prefab. Must be unique.</param>
        /// <param name="addZNetView">If true a ZNetView component will be added to the prefab for network sync.</param>
        /// <param name="itemConfig">The recipe config for this custom item.</param>
        public CustomItem(string name, bool addZNetView, ItemConfig itemConfig)
        {
            ItemPrefab = PrefabManager.Instance.CreateEmptyPrefab(name, addZNetView);
            if (ItemPrefab)
            {
                ItemDrop = ItemPrefab.AddComponent <ItemDrop>();

                itemConfig.Item = name;
                Recipe          = new CustomRecipe(itemConfig.GetRecipe(), true, true);
            }
        }
Esempio n. 3
0
        /// <summary>
        ///     Custom item created as an "empty" primitive with a <see cref="global::Recipe"/> made from a <see cref="ItemConfig"/>.
        /// </summary>
        /// <param name="name">Name of the new prefab. Must be unique.</param>
        /// <param name="addZNetView">If true a ZNetView component will be added to the prefab for network sync.</param>
        /// <param name="itemConfig">The item config for this custom item.</param>
        public CustomItem(string name, bool addZNetView, ItemConfig itemConfig)
        {
            ItemPrefab = PrefabManager.Instance.CreateEmptyPrefab(name, addZNetView);
            ItemDrop   = ItemPrefab.AddComponent <ItemDrop>();
            ItemDrop.m_itemData.m_shared = new ItemDrop.ItemData.SharedData();
            itemConfig.Apply(ItemPrefab);
            FixConfig = true;
            var recipe = itemConfig.GetRecipe();

            if (recipe != null)
            {
                Recipe = new CustomRecipe(recipe, true, true);
            }
        }