using UnityEngine; public class HealthPickup : PickupItem { [Header("Health Settings")] [SerializeField] private int healAmount = 25; [SerializeField] private bool onlyCollectWhenDamaged = true; protected override bool CanCollect(GameObject player) { if (PlayerHealthController.Instance == null) return false; if (PlayerHealthController.Instance.IsDead) return false; if (onlyCollectWhenDamaged) { return PlayerHealthController.Instance.CurrentHealth < PlayerHealthController.Instance.MaxHealth; } return true; } protected override void ApplyPickupEffect(GameObject player) { if (PlayerHealthController.Instance != null) { PlayerHealthController.Instance.Heal(healAmount); } } }