| 1234567891011121314151617181920212223242526272829 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class MouseButton : MonoBehaviour
- {
- [SerializeField] RectTransform targetRTF;
- [SerializeField] Graphic targetGraphic;
- [SerializeField] Color selectedColor = new Color(1, 1, 1, 0.6f);
- Vector3 _scale;
- Color _color;
- public void OnSelect() {
- if (targetGraphic) {
- _color = targetGraphic.color;
- targetGraphic.color = selectedColor;
- }
- if (targetRTF) {
- _scale = targetRTF.localScale;
- targetRTF.localScale = _scale * 1.15f;
- }
- }
- public void OnExit() {
- if (targetGraphic) targetGraphic.color = _color;
- if (targetRTF) targetRTF.localScale = _scale;
- }
- }
|