public static void Initialize(int id, int cost, float weight) { var item = ResourcesPrefabManager.Instance.GetItemPrefab(id); var stats = new SL_ItemStats() { BaseValue = cost, MaxDurability = 100, RawWeight = weight, }; stats.ApplyToItem(item.GetComponent <ItemStats>()); var effects = new GameObject("Effects"); effects.transform.parent = item.transform; effects.AddComponent <SharpeningStoneEffect>(); }
private void OnPacksLoadedSetup() { var item = ResourcesPrefabManager.Instance.GetItemPrefab(TOOLBOX_ID); var desc = item.Description; desc = desc.Replace("%COST%", ToolboxScrapCostPerUse.Value.ToString()); CustomItems.SetDescription(item, desc); var stats = new SL_ItemStats() { BaseValue = ToolboxSilverCostFromStore.Value, MaxDurability = 100, RawWeight = 5.0f, }; stats.ApplyToItem(item.GetComponent <ItemStats>()); // add our custom effect var effects = new GameObject("Effects"); effects.transform.parent = item.transform; effects.AddComponent <ToolboxEffect>(); }
// Set up the Toolbox item prefab private void SetupToolboxItem() { var item = ResourcesPrefabManager.Instance.GetItemPrefab(TOOLBOX_ID); var desc = item.Description; desc = desc.Replace("%COST%", settings.Iron_Scrap_Cost.ToString()); CustomItems.SetDescription(item, desc); var stats = new SL_ItemStats() { BaseValue = settings.Toolbox_Cost, MaxDurability = 100, RawWeight = 5.0f, }; stats.ApplyToItem(item.GetComponent <ItemStats>()); // add our custom effect var effects = new GameObject("Effects"); effects.transform.parent = item.transform; effects.AddComponent <ToolboxEffect>(); }