summaryrefslogtreecommitdiff
path: root/GameCode/SimulatedSelection.cs
blob: d80866bbe942ddb398136cf1f63b22416528efc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using UnityEngine;
using UnityEngine.UI;

public class SimulatedSelection : MonoBehaviour
{
	private HoverEvent hoverEvent;

	private Button button;

	private void Start()
	{
		hoverEvent = GetComponent<HoverEvent>();
		button = GetComponent<Button>();
	}

	private void OnDisable()
	{
		Deselect();
	}

	public void Select()
	{
		hoverEvent.OnPointerEnter(null);
		button.targetGraphic.color = button.colors.highlightedColor;
	}

	public void Deselect()
	{
		hoverEvent.OnPointerExit(null);
		button.OnDeselect(null);
		button.targetGraphic.color = button.colors.normalColor;
	}
}