+ Ui Particle package + Unity UI Extensions package + AnimateUIMaterials-main package + AllIn1VfxToolkit package + Title 변경 중 오류 수정 + 전투 플레이어 죽을 때, 플레이어의 스킬 모두 중단 + 전투 플레이어의 스킬 게이지 Ui가 100%가 되었을 때, 하이라이트 효과 추가 + Bloom Volume 추가
88 lines
2.5 KiB
C#
88 lines
2.5 KiB
C#
using System;
|
|
using DG.Tweening;
|
|
using Sirenix.OdinInspector;
|
|
using TMPro;
|
|
using UnityEditor.Searcher;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace BlueWater.Uis
|
|
{
|
|
public class CombatSkillUi : MonoBehaviour
|
|
{
|
|
[SerializeField, Required]
|
|
private Image _skillGaugeFillImage;
|
|
|
|
[SerializeField, Required]
|
|
private TMP_Text _percentText;
|
|
|
|
[SerializeField]
|
|
private Image _highlightOutline;
|
|
|
|
[SerializeField, Required]
|
|
private Image _fadeImage;
|
|
|
|
[SerializeField]
|
|
private Vector2 _fadeInOutDuration = new(0.05f, 0.2f);
|
|
|
|
private Tween _coolDownTween;
|
|
private Tween _fadeTween;
|
|
private bool _isQuitting;
|
|
|
|
private void OnApplicationQuit()
|
|
{
|
|
_isQuitting = true;
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
if (_isQuitting) return;
|
|
|
|
_coolDownTween.Kill();
|
|
_fadeTween.Kill();
|
|
}
|
|
|
|
[Button("컴포넌트 초기화")]
|
|
private void InitializeComponents()
|
|
{
|
|
_skillGaugeFillImage = transform.Find("SkillGaugeFillImage").GetComponent<Image>();
|
|
_percentText = transform.Find("PercentText").GetComponent<TMP_Text>();
|
|
_highlightOutline = _skillGaugeFillImage.transform.Find("HighlightOutline").GetComponent<Image>();
|
|
_fadeImage = transform.Find("FadeImage").GetComponent<Image>();
|
|
}
|
|
|
|
public void CoolDown(float fillDuration)
|
|
{
|
|
_highlightOutline.enabled = false;
|
|
SetFill(0f);
|
|
|
|
_coolDownTween = _skillGaugeFillImage.DOFillAmount(1f, fillDuration)
|
|
.OnUpdate(() =>
|
|
{
|
|
_percentText.text = (int)(_skillGaugeFillImage.fillAmount * 100) + "%";
|
|
})
|
|
.OnComplete(() =>
|
|
{
|
|
SetFill(1f);
|
|
_fadeImage.color = new Color(1, 1, 1, 0);
|
|
_fadeTween = _fadeImage.DOFade(1f, _fadeInOutDuration.x).OnComplete(() =>
|
|
{
|
|
_fadeImage.DOFade(0f, _fadeInOutDuration.y);
|
|
_highlightOutline.enabled = true;
|
|
});
|
|
});
|
|
}
|
|
|
|
public void ResetSkillUi()
|
|
{
|
|
SetFill(1f);
|
|
_highlightOutline.enabled = true;
|
|
}
|
|
|
|
private void SetFill(float value)
|
|
{
|
|
_skillGaugeFillImage.fillAmount = value;
|
|
_percentText.text = (int)(value * 100) + "%";
|
|
}
|
|
}
|
|
} |