using UnityEngine; namespace Heroes.Battle { /// /// Designer-authored unit prototype. An army slot references one of these /// plus a count; every combat stat lives here so balancing happens in the /// editor without touching code. /// [CreateAssetMenu(menuName = "Heroes/Battle/Unit", fileName = "Unit")] public sealed class UnitDefinition : ScriptableObject { [Tooltip("Stable identifier used in save data / configs. Leave empty to use asset name.")] public string id; [Tooltip("Human-readable name shown in UI. Leave empty to use asset name.")] public string displayName; [Tooltip("Battlefield sprite. Used only as a fallback when no 3D prefab is assigned.")] public Sprite sprite; [Tooltip("3D model prefab (with an Animator). When set, the battle view instantiates this " + "instead of a sprite/placeholder. Its position stays 2D; only its rotation is driven " + "through the virtual tilted plane.")] public GameObject prefab; [Header("Stats")] [Min(0)] public int attack = 1; [Min(0)] public int defense = 1; [Tooltip("Health of a single unit. A stack's total health is health * count.")] [Min(1)] public int health = 10; [Tooltip("Movement speed in hexes; also decides turn order (faster acts first).")] [Min(1)] public int speed = 5; [Tooltip("How many hexes wide the unit is (1 = normal, 2 = wide, e.g. cavalry or dragons).")] [Range(1, 2)] public int hexWidth = 1; public string ResolveId() => string.IsNullOrEmpty(id) ? name : id; public string ResolveDisplayName() => string.IsNullOrEmpty(displayName) ? name : displayName; } }