mirror of
https://github.com/DerTyp7/defrain-shooter-unity.git
synced 2025-10-30 21:17:09 +01:00
@@ -1,39 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class MenuBtn : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
[Header("Background Image")]
|
||||
[SerializeField] private GameObject BtnBgImage;
|
||||
[SerializeField] private Color BgColor;
|
||||
[SerializeField] private Color OnHoverBgColor;
|
||||
|
||||
private bool mouse_over = false;
|
||||
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (mouse_over)
|
||||
{
|
||||
BtnBgImage.GetComponent<Image>().color = OnHoverBgColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
BtnBgImage.GetComponent<Image>().color = BgColor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void OnPointerEnter(PointerEventData e)
|
||||
{
|
||||
mouse_over = true;
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData e)
|
||||
{
|
||||
mouse_over = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user