using GadgetCore.API;
using UnityEngine;

namespace AncientReassembler
{
  public class CraftButtonScript : MonoBehaviour
  {
    private void OnMouseEnter()
    {
      var render = gameObject.GetComponent<Renderer>();
      render.material = texture2;
      gameObject.GetComponent<AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/hover"), Menuu.soundLevel / 10f);
    }

    private void OnMouseExit()
    {
      var render = gameObject.GetComponent<Renderer>();
      render.material = texture1;
    }

    private void OnEnable()
    {
      var render = gameObject.GetComponent<Renderer>();
      render.material = texture1;
    }

    private static Material texture1 = new Material(Shader.Find("Unlit/Transparent"))
    {
      mainTexture = GadgetCoreAPI.LoadTexture2D("bAncientReassembler1.png")
    };

    private static Material texture2 = new Material(Shader.Find("Unlit/Transparent"))
    {
      mainTexture = GadgetCoreAPI.LoadTexture2D("bAncientReassembler2.png")
    };

  }

}