Files
bansonic_beta_main/Assets/scripts/Data/EnemyData_SO.cs
T

139 lines
4.4 KiB
C#

using UnityEngine;
using System.Collections.Generic;
using Spine.Unity;
[CreateAssetMenu(fileName = "NewEnemyData", menuName = "SO_Data/EnemyData")]
public class EnemyData_SO : ScriptableObject
{
[Header("Inspector")]
[Tooltip("Documentation text normalized.")]
public string enemyName;
public Sprite enemy_Image;
[Header("Spine Settings")]
[Tooltip("Assign the SkeletonDataAsset for the Spine animation here")]
public SkeletonDataAsset skeletonDataAsset;
[SerializeField] private float xOffset = 0f;
[SerializeField] private float yOffset = -400f;
[SerializeField] private float scaleRatio = 1f;
[SerializeField] private bool flipX = false;
public float XOffset
{
get => xOffset;
set => xOffset = value;
}
public float YOffset
{
get => yOffset;
set => yOffset = value;
}
public float ScaleRatio
{
get => scaleRatio;
set => scaleRatio = value;
}
public bool FlipX
{
get => flipX;
set => flipX = value;
}
public Sprite enemy_Profile;
[Tooltip("Documentation text normalized.")]
public int enemyID;
[Header("Inspector")]
public EnemyType enemyType = EnemyType.Simple;
[Header("Reward")]
[Tooltip("Flat bounty score bonus added on top of the HP-based bounty formula.")]
public int enemyBountyBonus = 0;
public enum EnemyType
{
Simple,
Elite,
Boss,
Legend,
Guardian
}
//[Header("Stats")]
[System.Serializable]
public struct EnemyDifficultyStats
{
public int difficultyID;
public int enemy_maxHP;
public float enemy_damageResistance;
public int enemy_baseAttack;
public int enemy_maxMana;
public int scoreOnBeingDefeated;
}
[Tooltip("Stats for each difficulty level (0-3).")]
public List<EnemyDifficultyStats> difficultyStatsList = new List<EnemyDifficultyStats>();
/// <summary>
/// Gets the stats for a specific difficulty ID (0-3).
/// If not found, returns the first available stats or default.
/// </summary>
public EnemyDifficultyStats GetStatsByDifficultyID(int difficultyID)
{
if (difficultyStatsList == null || difficultyStatsList.Count == 0) return default;
for (int i = 0; i < difficultyStatsList.Count; i++)
{
if (difficultyStatsList[i].difficultyID == difficultyID) return difficultyStatsList[i];
}
return difficultyStatsList[0];
}
/// <summary>
/// Updates the max HP for a specific difficulty at runtime.
/// Note: This modifies the ScriptableObject asset.
/// </summary>
public void SetMaxHPByDifficulty(int difficultyID, int newHP)
{
if (difficultyStatsList == null) return;
for (int i = 0; i < difficultyStatsList.Count; i++)
{
if (difficultyStatsList[i].difficultyID == difficultyID)
{
var stats = difficultyStatsList[i];
stats.enemy_maxHP = newHP;
difficultyStatsList[i] = stats;
return;
}
}
}
// Skills (same idea as AllyHero_SO)
[Header("Skills")]
public SkillDefinition[] availableSkills;
[Tooltip("Indexes into availableSkills for preselected skills; empty means none selected")]
public int[] selectedSkillIndices = new int[0];
[Tooltip("Primary selected skill index into availableSkills (-1 = none)")]
public int primarySkillIndex = -1;
public SkillDefinition GetPrimarySkill()
{
if (availableSkills == null || primarySkillIndex < 0 || primarySkillIndex >= availableSkills.Length) return null;
return availableSkills[primarySkillIndex];
}
// New: groups of skills. Each group contains a numeric skillGroupID and a variable-length list of SkillDefinitions.
[Tooltip("Skill groups defined on this enemy. Each SkillGroup has a numeric skillGroupID which can be equipped into slots to allow activation of the entire group via that ID.")]
public SkillGroup[] skillGroups = new SkillGroup[0];
[Tooltip("Equipped skill group IDs for this enemy. Each int references a skillGroupID defined in skillGroups. Use 0 to indicate empty.")]
public int[] equippedSkillGroupIDs = new int[0];
[Header("Combat Settings")]
[Tooltip("Documentation text normalized.")]
[Range(0f, 1f)]
public float manaGainOnDamagePercent = 0.2f; // default 20%
}