using System; using UnityEngine; namespace Minigames.FortFight.Data { /// /// Configuration data for a projectile type. /// Stored centrally in FortFightSettings instead of individual ScriptableObject assets. /// [Serializable] public class ProjectileConfig { [Header("Identity")] [Tooltip("Type of projectile this config represents")] public ProjectileType projectileType; [Tooltip("Unique string identifier (auto-generated from type)")] public string projectileId; [Header("Prefab")] [Tooltip("Prefab for this projectile (should have ProjectileBase component)")] public GameObject prefab; [Header("Ammunition System")] [Tooltip("Cooldown in turns after use")] public int cooldownTurns = 2; [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")] [TextArea(2, 4)] public string description; [Header("Combat Stats")] [Tooltip("Damage dealt on impact")] public float damage = 20f; [Header("Physics")] [Tooltip("Mass for physics simulation (affects trajectory and force)")] public float mass = 1f; /// /// Get the ProjectileBase component from the prefab /// public Projectiles.ProjectileBase GetProjectileComponent() { if (prefab == null) return null; return prefab.GetComponent(); } /// /// Get damage value from config /// public float GetDamage() { return damage; } /// /// Get mass value from config /// public float GetMass() { return mass; } /// /// Validate and auto-generate projectileId from type /// public void Validate() { if (string.IsNullOrEmpty(projectileId)) { projectileId = GenerateIdFromType(projectileType); } if (string.IsNullOrEmpty(displayName)) { displayName = projectileType.ToString(); } } private string GenerateIdFromType(ProjectileType type) { return type.ToString().ToLower(); } } }