editing scenes and UI

This commit is contained in:
2022-11-12 20:23:45 +05:00
parent 3b584eda20
commit 775fa9bdec
81 changed files with 19784 additions and 4729 deletions
+11 -3
View File
@@ -3,11 +3,14 @@ using System.Collections.Generic;
using DG.Tweening;
using UnityEngine;
using UnityEngine.Events;
[RequireComponent(typeof(CanvasGroup))]
public class UICanvas : MonoBehaviour
{
CanvasGroup canvasGroup;
public UnityEvent OnHide;
[SerializeField] float duration;
void Start()
{
@@ -16,19 +19,24 @@ public class UICanvas : MonoBehaviour
public void Show()
{
canvasGroup.DOFade(1, .4f);
canvasGroup.DOFade(1, duration);
}
public void Hide()
{
canvasGroup.DOFade(0, .4f);
gameObject.SetActive(false);
canvasGroup.DOFade(0, duration)
.OnComplete(() =>
{
OnHide?.Invoke();
gameObject.SetActive(false);
});
}
void OnEnable()
{
if(canvasGroup == null)
canvasGroup = GetComponent<CanvasGroup>();
canvasGroup.alpha = 0;
Show();
}