chore: Assets 디렉토리 구조 정리 및 네이밍 컨벤션 적용
- Assets/_Game/ 하위로 게임 에셋 통합 - External/ 패키지 벤더별 분류 (Synty, Animations, UI) - 에셋 네이밍 컨벤션 확립 및 적용 (Data_Skill_, Data_SkillEffect_, Prefab_, Anim_, Model_, BT_ 등) - pre-commit hook으로 네이밍 컨벤션 자동 검사 추가 - RESTRUCTURE_CHECKLIST.md 작성 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
86
Assets/External/UI/InterfaceFantasyWarriorHUD/Samples/Scripts/SampleRadialFillBar.cs
vendored
Normal file
86
Assets/External/UI/InterfaceFantasyWarriorHUD/Samples/Scripts/SampleRadialFillBar.cs
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
// Copyright (c) 2024 Synty Studios Limited. All rights reserved.
|
||||
//
|
||||
// Use of this software is subject to the terms and conditions of the Synty Studios End User Licence Agreement (EULA)
|
||||
// available at: https://syntystore.com/pages/end-user-licence-agreement
|
||||
//
|
||||
// Sample scripts are included only as examples and are not intended as production-ready.
|
||||
|
||||
using System.Collections;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Synty.Interface.FantasyWarriorHUD.Samples
|
||||
{
|
||||
/// <summary>
|
||||
/// A simple radial fill bar that fills and empties.
|
||||
/// </summary>
|
||||
public class SampleRadialFillBar : MonoBehaviour
|
||||
{
|
||||
[Header("References")]
|
||||
public Image image;
|
||||
public TMP_Text text;
|
||||
|
||||
[Header("Parameters")]
|
||||
public float fillAmountFull = 1f;
|
||||
public float inSpeed = 5f;
|
||||
public float outSpeed = 5f;
|
||||
public float startDelay;
|
||||
public float inDelay = 2.5f;
|
||||
public float outDelay = 2.5f;
|
||||
public string labelText = "{0}%";
|
||||
|
||||
public string LabelText => string.Format(labelText, (image.fillAmount / fillAmountFull * 100f).ToString("0"));
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (image == null)
|
||||
{
|
||||
image = GetComponentInChildren<Image>();
|
||||
}
|
||||
|
||||
if (text == null)
|
||||
{
|
||||
text = GetComponentInChildren<TMP_Text>();
|
||||
}
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
image = GetComponentInChildren<Image>();
|
||||
text = GetComponentInChildren<TMP_Text>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
StartCoroutine(C_TweenBackAndForth());
|
||||
}
|
||||
|
||||
private IEnumerator C_TweenBackAndForth()
|
||||
{
|
||||
yield return new WaitForSeconds(startDelay);
|
||||
|
||||
while (true)
|
||||
{
|
||||
yield return C_TweenFloat(0, 1, inSpeed);
|
||||
yield return new WaitForSeconds(outDelay);
|
||||
yield return C_TweenFloat(1, 0, outSpeed);
|
||||
yield return new WaitForSeconds(inDelay);
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator C_TweenFloat(float startValue, float endValue, float duration)
|
||||
{
|
||||
float time = 0f;
|
||||
while (time < 1f)
|
||||
{
|
||||
time += Time.deltaTime / duration;
|
||||
float currentValue = Mathf.Lerp(startValue, endValue, time);
|
||||
|
||||
image.fillAmount = currentValue * fillAmountFull;
|
||||
text?.SetText(LabelText);
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user