summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/ButtonRolloverHandler.cs
blob: 963058d6bcb50ad30947669de446946a4aac0fe1 (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
34
35
using System;
using UnityEngine;
using UnityEngine.Events;

public class ButtonRolloverHandler : MonoBehaviour
{
	public SpriteRenderer Target;

	public Color OverColor = Color.green;

	public Color OutColor = Color.white;

	public AudioClip HoverSound;

	public void Start()
	{
		PassiveButton component = base.GetComponent<PassiveButton>();
		component.OnMouseOver.AddListener(new UnityAction(this.DoMouseOver));
		component.OnMouseOut.AddListener(new UnityAction(this.DoMouseOut));
	}

	public void DoMouseOver()
	{
		this.Target.color = this.OverColor;
		if (this.HoverSound)
		{
			SoundManager.Instance.PlaySound(this.HoverSound, false, 1f);
		}
	}

	public void DoMouseOut()
	{
		this.Target.color = this.OutColor;
	}
}