using UnityEngine;
namespace Minigames.FortFight.Data
{
///
/// ScriptableObject defining a projectile type for the ammunition system.
/// Only stores prefab reference and UI data - stats come from the prefab's ProjectileBase component.
///
[CreateAssetMenu(fileName = "ProjectileData", menuName = "AppleHills/Fort Fight/Projectile Data", order = 1)]
public class ProjectileData : ScriptableObject
{
[Header("Prefab")]
[Tooltip("Prefab for this projectile (should have ProjectileBase component)")]
public GameObject prefab;
[Header("Ammunition System")]
[Tooltip("Cooldown time in seconds after use")]
public float cooldownTime = 5f;
[Header("UI")]
[Tooltip("Icon sprite for ammunition UI")]
public Sprite icon;
[Tooltip("Display name for this projectile type")]
public string displayName;
[Tooltip("Description of projectile behavior (for tutorial/UI)")]
[TextArea(2, 4)]
public string description;
///
/// Get the ProjectileBase component from the prefab (for reading stats)
///
public Projectiles.ProjectileBase GetProjectileComponent()
{
if (prefab == null) return null;
return prefab.GetComponent();
}
///
/// Get damage value from prefab
///
public float GetDamage()
{
var component = GetProjectileComponent();
return component != null ? component.Damage : 0f;
}
}
}