35 lines
888 B
C#
35 lines
888 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using DG.Tweening;
|
|
|
|
[RequireComponent(typeof(CanvasGroup))]
|
|
public class UIMenu : MonoBehaviour
|
|
{
|
|
[SerializeField] private UIMenu _nextMenu;
|
|
[SerializeField] private UIMenu _previousMenu;
|
|
|
|
private RectTransform _rectTransfrom;
|
|
private CanvasGroup _canvasGroup;
|
|
|
|
private void Awake()
|
|
{
|
|
_rectTransfrom = GetComponent<RectTransform>();
|
|
_canvasGroup = GetComponent<CanvasGroup>();
|
|
}
|
|
|
|
public void ShowNextMenu()
|
|
{
|
|
_nextMenu?.gameObject.SetActive(true);
|
|
_canvasGroup.DOFade(0, .15f)
|
|
.OnComplete(() => gameObject.SetActive(false));
|
|
}
|
|
|
|
public void ShowPreviousMenu()
|
|
{
|
|
_previousMenu?.gameObject.SetActive(true);
|
|
_canvasGroup.DOFade(0, .15f)
|
|
.OnComplete(() => gameObject.SetActive(false));
|
|
}
|
|
}
|