using GadgetCore.API;
using UnityEngine;

namespace StasisPod
{
  public static class ItemUtil
  {
    public static TileInfo CreatePlacableItem(string tileImgPath, string itemImgPath, string name, GameObject tileObject)
    {

      Texture2D textureTile = GadgetCoreAPI.LoadTexture2D(tileImgPath);
      Texture2D textureItem = GadgetCoreAPI.LoadTexture2D(itemImgPath);

      GameObject gameObject = Object.Instantiate(tileObject);
      gameObject.name = name;
      gameObject.AddComponent<StasisPodScript>();

      ItemInfo itemInfo = new ItemInfo(ItemType.GENERIC, name, "", textureItem);
      itemInfo.Register(name);
      var tile = new TileInfo(TileType.INTERACTIVE, textureTile, gameObject, itemInfo);
      tile.Register(name);
      return tile;
    }
  }
}
