修了很多bug和增加功能,优化不少问题
This commit is contained in:
@@ -51,25 +51,59 @@ public class EnemyData_SO : ScriptableObject
|
||||
Simple,
|
||||
Elite,
|
||||
Boss,
|
||||
Legend
|
||||
Legend,
|
||||
Guardian
|
||||
}
|
||||
|
||||
[Header("Stats")]
|
||||
[Tooltip("Documentation text normalized.")]
|
||||
public int enemy_maxHP;
|
||||
//[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("Documentation text normalized.")]
|
||||
public float enemy_damageResistance;
|
||||
[Tooltip("Stats for each difficulty level (0-3).")]
|
||||
public List<EnemyDifficultyStats> difficultyStatsList = new List<EnemyDifficultyStats>();
|
||||
|
||||
[Tooltip("Documentation text normalized.")]
|
||||
public int enemy_baseAttack;
|
||||
/// <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];
|
||||
}
|
||||
|
||||
// Documentation text normalized.
|
||||
[Tooltip("Documentation text normalized.")]
|
||||
public int enemy_maxMana = 0;
|
||||
return difficultyStatsList[0];
|
||||
}
|
||||
|
||||
[Header("Inspector")]
|
||||
public int scoreOnBeingDefeated;
|
||||
/// <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")]
|
||||
@@ -93,13 +127,6 @@ public class EnemyData_SO : ScriptableObject
|
||||
[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];
|
||||
|
||||
// Helper to query effective max mana based on type
|
||||
public int GetEffectiveMaxMana()
|
||||
{
|
||||
// Treat configured enemy_maxMana as authoritative for runtime; designers can set to 0 if not used.
|
||||
return enemy_maxMana;
|
||||
}
|
||||
|
||||
[Header("Combat Settings")]
|
||||
[Tooltip("Documentation text normalized.")]
|
||||
[Range(0f, 1f)]
|
||||
|
||||
Reference in New Issue
Block a user