2021-08-31 17:11:43 +08:00

41 lines
990 B
C#

using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class RaceMaskScript : MonoBehaviour, IPointerEnterHandler,IPointerExitHandler
{
public float? localY { get; set; }
public void OnPointerEnter(PointerEventData eventData)
{
transform.Find("Panel").GetComponent<CanvasGroup>().DOFade(1, 0.5f);
if (!localY.HasValue)
{
localY = transform.localPosition.y;
}
transform.DOLocalMoveY(localY.Value + 5, 0.3f);
}
public void OnPointerExit(PointerEventData eventData)
{
transform.Find("Panel").GetComponent<CanvasGroup>().DOFade(0, 0.5f);
if (localY.HasValue)
{
transform.DOLocalMoveY(localY.Value, 0.3f);
}
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}