using UnityEngine; using GadgetCore.API; namespace CombatChipChest { public static class ItemUtil { public static TileInfo CreatePlacableItem(string tileImgPath, string itemImgPath, string name) { Texture2D textureTile = GadgetCoreAPI.LoadTexture2D(tileImgPath); Texture2D textureItem = GadgetCoreAPI.LoadTexture2D(itemImgPath); GameObject gameObject = Object.Instantiate(GadgetCoreAPI.GetPlaceableNPCResource(2100)); gameObject.name = name; Renderer renderer = gameObject.GetComponentInChildren(); renderer.material = new Material(Shader.Find("Unlit/Transparent")) { mainTexture = textureTile }; ItemInfo itemInfo = new ItemInfo(ItemType.GENERIC, name, "", textureItem, -1, default, null, null, null, null); itemInfo.Register(name); var tile = new TileInfo(TileType.INTERACTIVE, textureTile, gameObject, itemInfo); tile.Register(name); return tile; } } }