18 lines
479 B
C#
18 lines
479 B
C#
using UnityEngine;
|
|
|
|
public class HealthPotion : MonoBehaviour
|
|
{
|
|
[Header("--- 포션 설정 ---")]
|
|
[SerializeField] private float healAmount = 30f; // 회복량
|
|
|
|
// PlayerInteraction에서 호출할 함수
|
|
public void Use(PlayerHealth target)
|
|
{
|
|
if (target == null) return;
|
|
|
|
target.Heal(healAmount); // 플레이어 체력 회복
|
|
Debug.Log($"<color=green>[Potion]</color> 체력 {healAmount} 회복!");
|
|
|
|
Destroy(gameObject); // 사용 후 아이템 삭제
|
|
}
|
|
} |