41 lines
990 B
C#
Raw Normal View History

2021-07-29 15:45:44 +08:00
using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class RaceMaskScript : MonoBehaviour, IPointerEnterHandler,IPointerExitHandler
{
2021-08-09 17:11:14 +08:00
public float? localY { get; set; }
2021-07-29 15:45:44 +08:00
public void OnPointerEnter(PointerEventData eventData)
{
2021-07-29 19:55:29 +08:00
transform.Find("Panel").GetComponent<CanvasGroup>().DOFade(1, 0.5f);
2021-08-27 15:06:56 +08:00
if (!localY.HasValue)
2021-08-09 16:32:47 +08:00
{
2021-08-27 15:06:56 +08:00
localY = transform.localPosition.y;
2021-08-09 16:32:47 +08:00
}
2021-08-27 15:06:56 +08:00
transform.DOLocalMoveY(localY.Value + 5, 0.3f);
2021-07-29 15:45:44 +08:00
}
public void OnPointerExit(PointerEventData eventData)
{
2021-07-29 19:55:29 +08:00
transform.Find("Panel").GetComponent<CanvasGroup>().DOFade(0, 0.5f);
2021-08-09 17:11:14 +08:00
if (localY.HasValue)
{
transform.DOLocalMoveY(localY.Value, 0.3f);
}
2021-07-29 15:45:44 +08:00
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}