ClientServer/Client/Assets/Scripts/Player/PlayerDeathMessage.cs
TG9six 03a642d635 first push
first push
2025-09-06 17:17:39 +04:00

30 lines
754 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using DG.Tweening;
public class PlayerDeathMessage : MonoBehaviour
{
[SerializeField] private TMP_Text playerDeathText;
[SerializeField] private CanvasGroup group;
private bool isChangingText;
private void Awake() => ResetText();
private void Update()
{
if (!string.IsNullOrWhiteSpace(playerDeathText.text) && !isChangingText)
{
isChangingText = true;
group.DOFade(0, 3.0f).SetDelay(2.0f).OnComplete(() => ResetText());
}
}
private void ResetText()
{
isChangingText = false;
playerDeathText.text = "";
group.alpha = 1.0f;
}
}