PartColliderData.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using System;
  2. using PrivateMaidMode;
  3. using UnityEngine;
  4. [RequireComponent(typeof(CapsuleCollider))]
  5. public class PartColliderData : MonoBehaviour
  6. {
  7. public CapsuleCollider capsuleCollider
  8. {
  9. get
  10. {
  11. return base.GetComponent<CapsuleCollider>();
  12. }
  13. set
  14. {
  15. CapsuleCollider component = base.GetComponent<CapsuleCollider>();
  16. }
  17. }
  18. public static void SetDefaultCursor()
  19. {
  20. Cursor.SetCursor(null, Vector2.zero, CursorMode.ForceSoftware);
  21. }
  22. private void Awake()
  23. {
  24. this.cursorTexture = (Texture2D)Resources.Load("ScenePrivate/Textures/TouchCursor");
  25. }
  26. private void OnDestroy()
  27. {
  28. this.SetHandCursor(false);
  29. }
  30. public void SetHandCursor(bool visible)
  31. {
  32. if (visible)
  33. {
  34. Cursor.SetCursor(this.cursorTexture, new Vector2((float)(this.cursorTexture.width / 2), (float)(this.cursorTexture.height / 2)), CursorMode.ForceSoftware);
  35. }
  36. else
  37. {
  38. PartColliderData.SetDefaultCursor();
  39. }
  40. }
  41. private void OnMouseEnter()
  42. {
  43. if (UICamera.Raycast(Input.mousePosition))
  44. {
  45. return;
  46. }
  47. if (this.canTouch)
  48. {
  49. this.SetHandCursor(true);
  50. this.isEnter = true;
  51. }
  52. }
  53. private void OnMouseExit()
  54. {
  55. if (this.isEnter)
  56. {
  57. this.SetHandCursor(false);
  58. }
  59. }
  60. private Texture2D cursorTexture;
  61. public bool canTouch;
  62. private bool isEnter;
  63. public TouchDataBase.TouchPoint point;
  64. }