Projext/Assets/5.TestScript/HealthAltar.cs
hydrozen1178 6e02e36997 기능 수정 본
회복 기능,적 아이템 드랍,등등
2026-01-30 01:11:10 +09:00

29 lines
838 B
C#

using UnityEngine;
public class HealthAltar : MonoBehaviour
{
[Header("--- 제단 설정 ---")]
[SerializeField] private float cooldown = 60f; // 재사용 대기시간
private float _nextUseTime = 0f;
// PlayerInteraction에서 호출할 함수
public void Use(PlayerHealth target)
{
if (target == null) return;
if (Time.time >= _nextUseTime)
{
// 제단은 강력하니까 풀피로 채워줍니다.
target.Heal(9999f);
_nextUseTime = Time.time + cooldown; // 쿨타임 설정
Debug.Log("<color=cyan>[Altar]</color> 제단 사용! 기운이 넘칩니다.");
}
else
{
float remaining = Mathf.Ceil(_nextUseTime - Time.time);
Debug.Log($"<color=yellow>[Altar]</color> 아직 기운이 모이지 않았습니다. ({remaining}초 남음)");
}
}
}