Ejemplo n.º 1
0
        private static void AddCustomItems()
        {
            string            RecipePath           = Path.Combine(ModPath, RecipeFileName);
            Assembly          ModAssembly          = typeof(HoneyPlus).Assembly;
            AssetBundle       HoneyPlusAssetBundle = AssetUtils.LoadAssetBundleFromResources(AssetBundleName, ModAssembly);
            List <ItemConfig> itemConfigs          = ItemConfig.ListFromJson(AssetUtils.LoadText(RecipePath));

            foreach (ItemConfig itemConfig in itemConfigs)
            {
                if (HoneyPlusAssetBundle.Contains(itemConfig.Name))
                {
                    GameObject prefab     = HoneyPlusAssetBundle.LoadAsset <GameObject>(itemConfig.Name);
                    CustomItem customItem = new CustomItem(prefab, true, itemConfig);
                    ItemManager.Instance.AddItem(customItem);
                }
            }
        }