using System.Collections;
|
using System.Collections.Generic;
|
using Unity.VisualScripting;
|
using UnityEngine;
|
using UnityEngine.Events;
|
|
public class SelectObject : MonoBehaviour
|
{
|
public Outline MyOutline;
|
|
public UnityEvent OnSelect;
|
|
public UnityEvent OnUnSelect;
|
|
[SerializeField]
|
private bool selected;
|
public bool Selected { get { return selected; } }
|
// Start is called before the first frame update
|
|
|
private void Start()
|
{
|
HideHoverEffect();
|
}
|
|
|
|
|
public void Select()
|
{
|
selected = true;
|
|
OnSelect?.Invoke();
|
}
|
public void UnSelect()
|
{
|
selected = false;
|
|
OnUnSelect?.Invoke();
|
}
|
|
|
private void ShowHoverEffect()
|
{
|
if (MyOutline != null)
|
MyOutline.enabled = true;
|
}
|
|
private void HideHoverEffect()
|
{
|
if (MyOutline != null)
|
MyOutline.enabled = false;
|
|
}
|
|
private void OnMouseEnter()
|
{
|
ShowHoverEffect();
|
}
|
|
private void OnMouseExit()
|
{
|
HideHoverEffect();
|
}
|
|
public void OnHover()
|
{
|
ShowHoverEffect();
|
}
|
|
public void OnExitHover()
|
{
|
HideHoverEffect();
|
}
|
|
}
|