using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class ButtonMouseOver : MonoBehaviour, ISelectHandler, IDeselectHandler, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler
{
protected bool toggle;
protected bool selected;
protected bool isOver;
public bool Selected
{
get { return this.selected; }
}
public bool IsOver
{
get { return this.isOver; }
}
public bool Toggled
{
get { return this.toggle; }
}
public virtual void OnSelect(BaseEventData eventData)
{
selected = true;
}
public virtual void OnDeselect(BaseEventData eventData)
{
selected = false;
}
public virtual void OnPointerEnter(PointerEventData eventData)
{
isOver = true;
}
public virtual void OnPointerExit(PointerEventData eventData)
{
isOver = false;
}
public virtual void OnPointerClick(PointerEventData eventData)
{
toggle = !toggle;
}
public virtual void ResetToggle()
{
toggle = false;
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.