Added rest of the sequencing
This commit is contained in:
@@ -14,7 +14,9 @@ public class MyButton : MonoBehaviour, IPointerClickHandler, IPointerEnterHandle
|
||||
|
||||
[SerializeField]
|
||||
public bool isActive = true;
|
||||
|
||||
|
||||
private bool _isPointerOver = false;
|
||||
|
||||
public void SetActive(bool active)
|
||||
{
|
||||
isActive = active;
|
||||
@@ -36,15 +38,20 @@ public class MyButton : MonoBehaviour, IPointerClickHandler, IPointerEnterHandle
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
if(isActive)
|
||||
if (isActive)
|
||||
_onClick.Invoke();
|
||||
}
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
_outlineFx.enabled = isActive;
|
||||
_isPointerOver = true;
|
||||
}
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
_outlineFx.enabled = false;
|
||||
_isPointerOver = false;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
_outlineFx.enabled = _isPointerOver && isActive;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user