CraftButtonScript.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using GadgetCore.API;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using UnityEngine;
  7. namespace AncientReassembler
  8. {
  9. public class CraftButtonScript : MonoBehaviour
  10. {
  11. private void OnMouseEnter()
  12. {
  13. var render = gameObject.GetComponent<Renderer>();
  14. render.material = texture2;
  15. gameObject.GetComponent<AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/hover"), Menuu.soundLevel / 10f);
  16. }
  17. private void OnMouseExit()
  18. {
  19. var render = gameObject.GetComponent<Renderer>();
  20. render.material = texture1;
  21. }
  22. private void OnEnable()
  23. {
  24. var render = gameObject.GetComponent<Renderer>();
  25. render.material = texture1;
  26. }
  27. private static Material texture1 = new Material(Shader.Find("Unlit/Transparent"))
  28. {
  29. mainTexture = GadgetCoreAPI.LoadTexture2D("bAncientReassembler1.png")
  30. };
  31. private static Material texture2 = new Material(Shader.Find("Unlit/Transparent"))
  32. {
  33. mainTexture = GadgetCoreAPI.LoadTexture2D("bAncientReassembler2.png")
  34. };
  35. }
  36. }