using UnityEngine; [CreateAssetMenu(fileName = "New Unit Data", menuName = "Battle Sim/Unit Data")] public class UnitData : ScriptableObject { [Header("Unit Identity")] public string unitName; public UnitType unitType; public Sprite unitIcon; [Header("Combat Stats")] public float health = 100f; public float damage = 20f; public float attackRange = 5f; // Increased from 2f for better combat public float attackSpeed = 1f; // attacks per second public float armor = 0f; // damage reduction [Header("Movement")] public float moveSpeed = 5f; public float rotationSpeed = 180f; // degrees per second [Header("Formation & Behavior")] public float formationSpacing = 2f; public float detectionRange = 10f; public float retreatHealthThreshold = 0.2f; // retreat when health drops below this percentage [Header("Unit Type Specific")] public bool canCharge = false; // cavalry charge ability public bool isRanged = false; // archer/ranged units public float projectileSpeed = 10f; // for ranged units public int maxAmmo = 30; // for archers [Header("AI Preferences")] public float aggressiveness = 0.5f; // 0 = defensive, 1 = very aggressive public float disciplineLevel = 0.7f; // how well they follow orders vs acting independently [Header("RaycastPro Integration")] [Tooltip("Automatically configure SightDetector with these values")] public bool autoConfigureSightDetector = true; [Tooltip("Field of view angle for X-axis (horizontal)")] public float sightAngleX = 120f; [Tooltip("Field of view angle for Y-axis (vertical)")] public float sightAngleY = 90f; [Tooltip("Full awareness radius - enemies detected instantly within this range")] public float fullAwarenessRadius = 3f; [Tooltip("Minimum detection radius")] public float minDetectionRadius = 1f; [Tooltip("Use pulse mode for detection (performance optimization)")] public bool usePulseDetection = true; [Tooltip("Detection pulse interval in seconds")] public float pulseInterval = 0.2f; [Tooltip("Limit the number of detected targets for performance")] public bool limitDetectedTargets = true; [Tooltip("Maximum number of targets to detect simultaneously")] public int maxDetectedTargets = 10; } public enum UnitType { Infantry, Cavalry, Archer, Siege }