using UnityEngine; using GadgetCore.API; namespace MoreLights { public static class ItemUtil { public static int CreatePlacableLightItem(string tileImgPath, string itemImgPath, string name, Color color) { Texture2D textureTile = GadgetCoreAPI.LoadTexture2D(tileImgPath); Texture2D textureItem = GadgetCoreAPI.LoadTexture2D(itemImgPath); GameObject gameObject = Object.Instantiate((GameObject)Resources.Load("prop/" + 2401)); gameObject.GetComponentInChildren().color = color; Renderer renderer = gameObject.GetComponentInChildren(); renderer.material = new Material(Shader.Find("Transparent/Diffuse")) { mainTexture = textureTile }; ItemInfo itemInfo = new ItemInfo(ItemType.GENERIC, name, "", textureItem, -1, default, null, null, null, null); itemInfo.Register(name, -1, true); new TileInfo(TileType.NONSOLID, textureTile, gameObject, itemInfo).Register(name, -1, true); return itemInfo.GetID(); } } }