using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; namespace SoftKitty { public class HoverEffect : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerDownHandler, IPointerUpHandler { public RectTransform _targetGraphic; public bool _usePosition = false; public Vector2 _hoverPosition = Vector2.zero; public bool _useAngle = false; public float _hoverAngle = 0F; public bool _useColor = false; public Color _hoverColor = new Color(1F, 1F, 1F, 1F); public bool _useScale = false; public Vector3 _hoverScale = Vector3.one; public string _soundHover = "bt_hover"; public string _soundDown = "bt_down"; public string _soundUp = "bt_up"; #region Variables [HideInInspector] public bool isHover = false; Button mButton; Vector2 _oriPos; float _oriAngle; Color _oriColor; Color _oriColorSub; Vector3 _oriScale; bool inited = false; #endregion #region Internal Methods public void OnPointerEnter(PointerEventData eventData) { if (mButton) { if (!mButton.interactable) return; } isHover = true; SoundManager.Play2D(_soundHover); } public void OnPointerExit(PointerEventData eventData) { isHover = false; } void Start() { Init(); } void OnEnable() { Init(); } void Init() { if (inited) { ResetColor(); return; } if (GetComponent