技能主要更新,修复卡顿并加入动画,以及各种其他更新。

This commit is contained in:
FloatGaming
2026-02-07 21:05:17 +08:00
parent abeca51be5
commit 1ac3cd0104
1349 changed files with 1526749 additions and 24850 deletions
+165 -111
View File
@@ -16,7 +16,7 @@ public class teamUIController : MonoBehaviour
}
// --- ID бϵ 5 Ѿ ---
// --- 根据角色 ID 列表初始化 5 个队友槽位 ---
[Header("UI Effects")]
public Material grayScaleMaterial;
public Color hurtColor = Color.red;
@@ -30,23 +30,22 @@ public class teamUIController : MonoBehaviour
[Tooltip("IDs for the 5 ally slots (top to bottom). These are used by PopulateAllySOsFromIds to resolve SOs into currentAllySOs.")]
public List<int> allySlotIds = new List<int> { 0, 0, 0, 0, 0 };
// --- ˶в ID б˳ ---
// --- 敌人 ID 列表(按出现顺序) ---
[Header("Runtime enemy configuration")]
[Tooltip("IDs for enemies to appear in sequence. All enemies share a single GameObject and will be initialized from these SOs in order.")]
public List<int> enemySlotIds = new List<int>() { 0, 0, 0, 0, 0 };
// --- ĵǰ SO ã˳ ---
// --- 缓存当前的队友 SO 引用 ---
private TeamCharacterDataInfo[] currentAllySOs = new TeamCharacterDataInfo[5];
// ĵǰ SO б˳
// 缓存当前的敌人 SO 列表
private EnemyData_SO[] currentEnemySOs = new EnemyData_SO[0];
// ѽġЧĵ SO id==0 δҵ
// 缓存已识别的有效敌人 SO 列表(排除 id==0 或未找到的项)
private EnemyData_SO[] recognizedEnemySOs = new EnemyData_SO[0];
// previous active flags for detecting external changes
private bool[] prevAllyActive = new bool[5];
// ·ֶΣһڱ༭ңд Assets/Resources/so/ally ̾·
// һʱңResources · so/ally
// 路径字段:一个用于编辑器环境(Assets/Resources/so/ally),一个用于运行时(Resources 相对路径 so/ally
[Header("SO folder paths")]
[Tooltip("Editor-only: project path or absolute disk path to the folder that contains SOs. Example: Assets/Resources/so/ally")]
public string editorSOFolderPath = "Assets/Resources/so/ally";
@@ -54,7 +53,7 @@ public class teamUIController : MonoBehaviour
[Tooltip("Runtime: Resources subfolder path (no 'Resources/' prefix). Example: so/ally")]
public string runtimeResourcesFolderPath = "so/ally";
// SO ·Editor / Runtime
// 敌人 SO 路径(编辑器/运行时)
[Tooltip("Editor-only: project path or absolute disk path to the folder that contains enemy SOs. Example: Assets/Resources/so/enemies")]
public string editorEnemySOFolderPath = "Assets/Resources/so/enemies";
@@ -115,20 +114,20 @@ public class teamUIController : MonoBehaviour
totalManaRestored[slotIndex] += amount;
}
// ݾֶΣѡ
// 路径字段(可选)
[Header("Editor folder load (Editor only)")]
[Tooltip("Deprecated: kept for compatibility. Use editorSOFolderPath or runtimeResourcesFolderPath instead.")]
public string selectedProjectFolderPath = string.Empty;
/// <summary>
/// /еã allySlotIds5 intָļӦ TeamCharacterDataInfo ʲ
/// Editor: ʹ editorSOFolderPath / selectedProjectFolderPathRuntime: ʹ runtimeResourcesFolderPath / selectedProjectFolderPath
/// 在 Awake 或编辑器中调用,根据 allySlotIds 将 ID 映射到 SO 资产
/// 编辑器环境使用 editorSOFolderPath,运行时使用 runtimeResourcesFolderPath
/// </summary>
public void PopulateAllySOsFromIds()
{
if (allySlotIds == null || allySlotIds.Count < 5)
{
Debug.LogWarning("allySlotIds δȷãԶΪ 5 ռλ ID");
Debug.LogWarning("allySlotIds 未正确配置,自动重置为 5 个空位 ID");
allySlotIds = new List<int> { 0, 0, 0, 0, 0 };
}
@@ -151,7 +150,7 @@ public class teamUIController : MonoBehaviour
}
else
{
Debug.LogWarning("editorSOFolderPath λĿ Assets ļԱвѯд Assets/Resources/so/ally˵ȫбҡ·ҲдΪ̾·");
Debug.LogWarning("editorSOFolderPath 并不位于项目 Assets 文件夹内。编辑器环境下的查询可能需要完整填写 Assets/Resources/so/ally,或者使用下拉列表来查找。路径也可以填写为绝对磁盘路径。");
}
}
@@ -202,7 +201,7 @@ public class teamUIController : MonoBehaviour
int id = allySlotIds[i];
TeamCharacterDataInfo found = null;
// slot ID Ϊ 0 -> رնӦ ally UI
// 如果 ID 0,禁用对应的队友 UI 槽位
if (id == 0)
{
currentAllySOs[i] = null;
@@ -219,7 +218,7 @@ public class teamUIController : MonoBehaviour
continue;
}
// ֻҪ asset ·ư id ãEditor
// 根据路径包含 ID 来匹配资产(编辑器环境)
for (int j = 0; j < discovered.Count; j++)
{
var obj = discovered[j];
@@ -250,14 +249,14 @@ public class teamUIController : MonoBehaviour
}
}
// ˵ȫ teamCharacterList
// 备选方案:搜索全局角色列表
if (found == null && globalList != null && globalList.characters != null)
{
for (int j = 0; j < globalList.characters.Count; j++)
{
var so = globalList.characters[j];
if (so == null) continue;
// globalList Ҳ name id Ϊ׼
// 在全局列表中根据名字包含 ID 来匹配
if (!string.IsNullOrEmpty(so.name) && so.name.Contains(id.ToString()))
{
found = so;
@@ -270,7 +269,7 @@ public class teamUIController : MonoBehaviour
if (found == null)
{
Debug.LogWarning($"[teamUIController] δҵ id={id} Ӧ SO (slot {i + 1})");
Debug.LogWarning($"[teamUIController] 未找到 id={id} 对应的 SO (slot {i + 1})");
// disable UI slot when not found
switch (i)
{
@@ -285,7 +284,7 @@ public class teamUIController : MonoBehaviour
else
{
Debug.Log($"[teamUIController] (Editor) slot {i + 1} resolved to SO: {found.name} (id={found.CharacterID})");
// ȷӦ UI slot
// 确保对应的 UI 槽位被激活
switch (i)
{
case 0: isAlly01_active = true; break;
@@ -371,7 +370,7 @@ public class teamUIController : MonoBehaviour
int id = allySlotIds[i];
TeamCharacterDataInfo found = null;
// slot ID Ϊ 0 -> رնӦ ally UI
// 检查 slot ID 是否为 0 -> 关闭对应 ally UI 槽位
if (id == 0)
{
currentAllySOs[i] = null;
@@ -390,7 +389,7 @@ public class teamUIController : MonoBehaviour
continue;
}
// ֻҪԴ id ãRuntime֧ TeamCharacterDataInfo AllyHero_SO
// 只要资源名包含 id 即可匹配(Runtime,同时支持 TeamCharacterDataInfo AllyHero_SO
string runtimeSourceInfo = string.Empty;
for (int j = 0; j < runtimeDiscovered.Count; j++)
{
@@ -431,7 +430,7 @@ public class teamUIController : MonoBehaviour
}
}
// ˵ȫ teamCharacterList
// 备选方案:搜索全局 teamCharacterList
if (found == null && globalList != null && globalList.characters != null)
{
for (int j = 0; j < globalList.characters.Count; j++)
@@ -467,7 +466,7 @@ public class teamUIController : MonoBehaviour
if (found == null)
{
Debug.LogWarning($"[teamUIController] (Runtime) δҵ id={id} Ӧ SO (slot {i + 1})");
Debug.LogWarning($"[teamUIController] (Runtime) 未找到 id={id} 对应的 SO (slot {i + 1})");
switch (i)
{
case 0: isAlly01_active = false; break;
@@ -713,30 +712,30 @@ public class teamUIController : MonoBehaviour
}
/// <summary>
/// صǰ SO б
/// 返回当前激活的队友 SO 列表的克隆副本
/// </summary>
public TeamCharacterDataInfo[] GetCurrentAllySOs()
{
return (TeamCharacterDataInfo[])currentAllySOs.Clone();
}
[Header("ı")]
[Tooltip("title")]
[Header("UI 文本引用")]
[Tooltip("歌曲名称标题")]
public TextMeshProUGUI songNametitle;
public TextMeshProUGUI difficultyName;
public TextMeshProUGUI difficultyID;
public TextMeshProUGUI constructionName;
[Tooltip("")]
[Tooltip("连击计数器")]
public Text comboCounter;
[Tooltip("˳")]
public Text enemyCounter;
[SerializeField] private int enemyCounterMax; // Ϸ
[SerializeField] private int enemyCurrentCount; // ڵĵ˳
[Tooltip("ǰܷ")]
[Tooltip("敌人序号计数器")]
public TextMeshProUGUI enemyCounter;
[SerializeField] private int enemyCounterMax; // 本局游戏敌人总数
[SerializeField] private int enemyCurrentCount; // 当前敌人序号
[Tooltip("当前总分")]
public TextMeshProUGUI currentTotalScore;
[Header("ܷ")]
[Header("精准判定总分")]
public TextMeshProUGUI allSum_pmScore;
[Header("ܷ")]
[Header("偶像加成总分")]
public TextMeshProUGUI allSum_idolScore;
// new: runtime enemy instance and UI sync fields
@@ -747,11 +746,11 @@ public class teamUIController : MonoBehaviour
private int prevEnemyMana = -1;
// For total enemy health bar
private int totalMaxHP = 0; // totalMaxHP
private int totalMaxHP = 0; // 敌人总血量上限
private Coroutine totalFadeHealthCoroutine;
// Ƴ private float prevTotalHealthFill = 1f;
// 移除 private float prevTotalHealthFill = 1f;
[Header("ComboжҪ")]
[Header("Combo判定类型要求")]
public ComboJudgeType comboJudgeType = ComboJudgeType.Perfect;
private int combo = 0;
@@ -764,76 +763,76 @@ public class teamUIController : MonoBehaviour
// Miss
}
[Header("teammate01")]
[Tooltip("-")]
[Header("队友 01")]
[Tooltip("队友01 - 游戏对象根节点")]
public GameObject objectFather_ally01;
[Tooltip("")]
[Tooltip("是否激活")]
public bool isAlly01_active = true;
[Tooltip("ɫͼ")]
[Tooltip("角色立绘")]
public Image teammate01_characterImage;
[Tooltip("Ѫ")]
[Tooltip("血条")]
public Image teammate01_healthImage;
[Tooltip("Ѫ")]
[Tooltip("血条淡出效果")]
public Image teammate01_fadehealthImage;
[Tooltip("")]
[Tooltip("蓝条")]
public Image teammate01_manaImage;
[Tooltip("")]
[Tooltip("蓝条淡出效果")]
public Image teammate01_fadeManaImage;
[Tooltip("ı")]
[Tooltip("角色名称文本")]
public TextMeshProUGUI teammate01_nameText;
[Tooltip("ǰֵ/ֵ")]
[Tooltip("当前血量百分比")]
public TextMeshProUGUI teammate01_healthRate;
[Tooltip("ǰ/")]
[Tooltip("当前分数百分比")]
public TextMeshProUGUI teammate01_current_scoreText; // rate : now score / max score
[Tooltip("ɫΨһʶ")]
[Tooltip("角色唯一标识符")]
[SerializeField] private int ally01_id;
[Tooltip("ܻ")]
[Tooltip("受击反馈红光")]
public Image teammate01_hurtRedImage;
[Tooltip("ǰֵ")]
[Tooltip("当前血量")]
[SerializeField] private int teammate01_currentHP;
[Tooltip("ֵ")]
[Tooltip("血量上限")]
[SerializeField] private int teammate01_maxHP;
[Tooltip("ǰֵ")]
[Tooltip("当前蓝量")]
[SerializeField] private int teammate01_currentMana;
[Tooltip("ֵ")]
[Tooltip("蓝量上限")]
[SerializeField] private int teammate01_maxMana;
[Header("pmScore")]
[Header("PM 分数统计")]
public TextMeshProUGUI red_pmScore_sum;
[Header("idolScore")]
[Header("Idol 分数统计")]
public TextMeshProUGUI red_idolScore_sum;
[Header("teammate02")]
[Tooltip("-")]
[Header("队友 02")]
[Tooltip("队友02 - 游戏对象根节点")]
public GameObject objectFather_ally02;
[Tooltip("")]
[Tooltip("是否激活")]
public bool isAlly02_active = true;
[Tooltip("ɫͼ")]
[Tooltip("角色立绘")]
public Image teammate02_characterImage;
[Tooltip("Ѫ")]
[Tooltip("血条")]
public Image teammate02_healthImage;
[Tooltip("Ѫ")]
[Tooltip("血条淡出效果")]
public Image teammate02_fadehealthImage;
[Tooltip("")]
[Tooltip("蓝条")]
public Image teammate02_manaImage;
[Tooltip("")]
[Tooltip("蓝条淡出效果")]
public Image teammate02_fadeManaImage;
[Tooltip("ı")]
[Tooltip("角色名称文本")]
public TextMeshProUGUI teammate02_nameText;
[Tooltip("ǰֵ/ֵ")]
[Tooltip("当前血量百分比")]
public TextMeshProUGUI teammate02_healthRate;
[Tooltip("ǰ/")]
[Tooltip("当前分数百分比")]
public TextMeshProUGUI teammate02_current_scoreText; // rate : now score / max score
[Tooltip("ɫΨһʶ")]
[Tooltip("角色唯一标识符")]
[SerializeField] private int ally02_id;
[Tooltip("ܻ")]
[Tooltip("受击反馈红光")]
public Image teammate02_hurtRedImage;
[Tooltip("ǰֵ")]
[Tooltip("当前血量")]
[SerializeField] private int teammate02_currentHP;
[Tooltip("ֵ")]
[Tooltip("血量上限")]
[SerializeField] private int teammate02_maxHP;
[Tooltip("ǰֵ")]
[Tooltip("当前蓝量")]
[SerializeField] private int teammate02_currentMana;
[Tooltip("ֵ")]
[Tooltip("蓝量上限")]
[SerializeField] private int teammate02_maxMana;
[Header("pmScore")]
public TextMeshProUGUI green_pmScore_sum;
@@ -974,9 +973,9 @@ public class teamUIController : MonoBehaviour
[Tooltip("Ѫ")]
public Image allEnemy_totalFadehealthImage;
[Tooltip("ı")]
public Text currentEnemy_nameText;
public TextMeshProUGUI currentEnemy_nameText;
[Tooltip("ı")]
public Text currentEnemy_typeText;
public TextMeshProUGUI currentEnemy_typeText;
[Tooltip("ǰֵ/ֵ")]
public TextMeshProUGUI currentEnemy_healthRate;
[Tooltip("еֵ/ֵܼ")]
@@ -1027,28 +1026,28 @@ public class teamUIController : MonoBehaviour
}
// Update is called once per frame
private float _lastEnemyCheckTime = 0f;
private const float ENEMY_CHECK_INTERVAL = 0.1f; // 100ms interval for UI sync
void Update()
{
// detect external changes to isAllyX_active and toggle objects accordingly
bool[] current = new bool[] { isAlly01_active, isAlly02_active, isAlly03_active, isAlly04_active, isAlly05_active };
for (int i = 0; i < 5; i++)
{
if (prevAllyActive[i] != current[i])
{
ToggleAllyObject(i, current[i]);
prevAllyActive[i] = current[i];
}
}
if (prevAllyActive[0] != isAlly01_active) { ToggleAllyObject(0, isAlly01_active); prevAllyActive[0] = isAlly01_active; }
if (prevAllyActive[1] != isAlly02_active) { ToggleAllyObject(1, isAlly02_active); prevAllyActive[1] = isAlly02_active; }
if (prevAllyActive[2] != isAlly03_active) { ToggleAllyObject(2, isAlly03_active); prevAllyActive[2] = isAlly03_active; }
if (prevAllyActive[3] != isAlly04_active) { ToggleAllyObject(3, isAlly04_active); prevAllyActive[3] = isAlly04_active; }
if (prevAllyActive[4] != isAlly05_active) { ToggleAllyObject(4, isAlly05_active); prevAllyActive[4] = isAlly05_active; }
// Sync enemy UI with EnemyCombatant values
if (enemyCombatantInstance != null)
// Sync enemy UI with EnemyCombatant values - optimized to not check every single frame if possible
if (enemyCombatantInstance != null && Time.time >= _lastEnemyCheckTime + ENEMY_CHECK_INTERVAL)
{
_lastEnemyCheckTime = Time.time;
int hp = enemyCombatantInstance.currentHP;
int mana = enemyCombatantInstance.currentMana;
if (prevEnemyHP != hp)
{
UpdateEnemyHealthVisuals(prevEnemyHP, hp, true);
// ǰ˵ HP 仯ʱҲҪѪ
// 当当前敌人的 HP 变化时,也需要更新总血量条
UpdateAllEnemyTotalHealthUIOnHpChange(hp);
prevEnemyHP = hp;
}
@@ -1074,7 +1073,7 @@ public class teamUIController : MonoBehaviour
}
/// <summary>
/// жϵͳãж"Perfect""Great""Good""Miss"
/// 处理判定系统调用,更新判定结果如 "Perfect", "Great", "Good", "Miss"
/// </summary>
public void OnJudgeResult(string result)
{
@@ -1087,7 +1086,11 @@ public class teamUIController : MonoBehaviour
combo = 0;
}
if (comboCounter != null)
comboCounter.text = combo.ToString();
{
_sb.Clear();
_sb.Append(combo);
comboCounter.text = _sb.ToString();
}
// --- Statistics: Update achievement tracking for combo ---
if (InGamePerformanceManager.Instance != null)
@@ -1105,7 +1108,7 @@ public class teamUIController : MonoBehaviour
}
/// <summary>
/// жϵǰжǷcomboҪ
/// 判断当前判定类型是否达到 combo 要求
/// </summary>
private bool IsCombo(string result)
{
@@ -1274,7 +1277,7 @@ public class teamUIController : MonoBehaviour
}
/// <summary>
/// ڵѾңֻ߲һ
/// 返回相邻的队友索引(通常用于范围效果),左右各一个
/// </summary>
public int[] GetAdjacentAllyIndices(int slotIndex)
{
@@ -1285,7 +1288,7 @@ public class teamUIController : MonoBehaviour
}
/// <summary>
/// ָλӦѾ GameObjectȷ allyX_object򷵻 objectFather_allyXXΪ null
/// 获取指定槽位对应的队友 GameObject,优先返回 allyX_object,否则返回 objectFather_allyXX,都没有则为 null
/// </summary>
public GameObject GetAllyObjectBySlot(int slotIndex)
{
@@ -1352,10 +1355,9 @@ public class teamUIController : MonoBehaviour
if (currentEnemy_healthRate != null) currentEnemy_healthRate.text = "0/0";
if (currentEnemy_manaImage != null) currentEnemy_manaImage.fillAmount = 0f;
if (currentEnemy_fademanaImage != null) currentEnemy_fademanaImage.fillAmount = 0f;
if (enemyCounter != null) enemyCounter.text = "0/0";
if (currentEnemy_typeText != null) currentEnemy_typeText.text = "(ͨ)";
if (currentEnemy_typeText != null) currentEnemy_typeText.text = "(普通)";
UpdateEnemyListText();
// ˢѪûеʱʾ 0/TotalMax
// 刷新总血量条(没有敌人时显示 0/TotalMax
UpdateAllEnemyTotalHealthUIImmediate();
return;
}
@@ -1372,10 +1374,9 @@ public class teamUIController : MonoBehaviour
if (currentEnemy_healthRate != null) currentEnemy_healthRate.text = "0/0";
if (currentEnemy_manaImage != null) currentEnemy_manaImage.fillAmount = 0f;
if (currentEnemy_fademanaImage != null) currentEnemy_fademanaImage.fillAmount = 0f;
if (enemyCounter != null) enemyCounter.text = "0/" + enemyCounterMax.ToString();
if (currentEnemy_typeText != null) currentEnemy_typeText.text = "(ͨ)";
if (currentEnemy_typeText != null) currentEnemy_typeText.text = "(普通)";
UpdateEnemyListText();
// ˢѪеʱʾ 0/TotalMax
// 刷新总血量条(所有敌人都处理完时显示 0/TotalMax
UpdateAllEnemyTotalHealthUIImmediate();
return;
}
@@ -1408,16 +1409,16 @@ public class teamUIController : MonoBehaviour
switch (so.enemyType)
{
case EnemyData_SO.EnemyType.Elite:
currentEnemy_typeText.text = "(Ӣ)";
currentEnemy_typeText.text = "(精英)";
break;
case EnemyData_SO.EnemyType.Boss:
currentEnemy_typeText.text = "()";
currentEnemy_typeText.text = "(首领)";
break;
case EnemyData_SO.EnemyType.Legend:
currentEnemy_typeText.text = "(ʷʫ)";
currentEnemy_typeText.text = "(史诗)";
break;
default:
currentEnemy_typeText.text = "(ͨ)";
currentEnemy_typeText.text = "(普通)";
break;
}
}
@@ -1433,7 +1434,9 @@ public class teamUIController : MonoBehaviour
// update enemy counter text
if (enemyCounter != null)
{
enemyCounter.text = $"{Mathf.Clamp(enemyCurrentCount + 1, 1, 999)}/{enemyCounterMax}";
_sb.Clear();
_sb.Append(Mathf.Clamp(enemyCurrentCount + 1, 1, 999)).Append("/").Append(enemyCounterMax);
enemyCounter.text = _sb.ToString();
}
// refresh the enemy list display
@@ -1452,7 +1455,16 @@ public class teamUIController : MonoBehaviour
displayIndex = Mathf.Clamp(enemyCurrentCount + 1, 1, total);
// show as "current/total" (e.g. 1/3). When no enemies, show 0/0
enemyList_rateText.text = total == 0 ? "0/0" : $"{displayIndex}/{total}";
if (total == 0)
{
enemyList_rateText.text = "0/0";
}
else
{
_sb.Clear();
_sb.Append(displayIndex).Append("/").Append(total);
enemyList_rateText.text = _sb.ToString();
}
}
private void OnEnemyDiedHandler(EnemyCombatant e)
@@ -1555,7 +1567,12 @@ public class teamUIController : MonoBehaviour
// 1. ʵѪ
allEnemy_totalHealthImage.fillAmount = newFill;
if (totalEnemy_healthRate != null) totalEnemy_healthRate.text = $"{totalCur}/{totalMaxHP}";
if (totalEnemy_healthRate != null)
{
_sb.Clear();
_sb.Append(totalCur).Append("/").Append(totalMaxHP);
totalEnemy_healthRate.text = _sb.ToString();
}
// 2. Animate fade bar (only when health decreases)
if (allEnemy_totalFadehealthImage != null)
@@ -1613,7 +1630,12 @@ public class teamUIController : MonoBehaviour
// ʵѪѪ
allEnemy_totalHealthImage.fillAmount = newFill;
if (allEnemy_totalFadehealthImage != null) allEnemy_totalFadehealthImage.fillAmount = newFill;
if (totalEnemy_healthRate != null) totalEnemy_healthRate.text = $"{totalCur}/{totalMaxHP}";
if (totalEnemy_healthRate != null)
{
_sb.Clear();
_sb.Append(totalCur).Append("/").Append(totalMaxHP);
totalEnemy_healthRate.text = _sb.ToString();
}
// ֹͣеѪ
if (totalFadeHealthCoroutine != null) StopCoroutine(totalFadeHealthCoroutine);
@@ -1629,20 +1651,37 @@ public class teamUIController : MonoBehaviour
if (currentEnemy_fadehealthImage != null)
currentEnemy_fadehealthImage.fillAmount = currentEnemy_healthImage != null ? currentEnemy_healthImage.fillAmount : (enemyCombatantInstance.maxHP > 0 ? (float)enemyCombatantInstance.currentHP / enemyCombatantInstance.maxHP : 0f);
if (currentEnemy_healthRate != null)
currentEnemy_healthRate.text = $"{enemyCombatantInstance.currentHP}/{enemyCombatantInstance.maxHP}";
{
_sb.Clear();
_sb.Append(enemyCombatantInstance.currentHP).Append("/").Append(enemyCombatantInstance.maxHP);
currentEnemy_healthRate.text = _sb.ToString();
}
// mana visuals (new)
if (currentEnemy_manaImage != null)
currentEnemy_manaImage.fillAmount = enemyCombatantInstance.maxMana > 0 ? (float)enemyCombatantInstance.currentMana / enemyCombatantInstance.maxMana : 0f;
if (currentEnemy_fademanaImage != null)
currentEnemy_fademanaImage.fillAmount = currentEnemy_manaImage != null ? currentEnemy_manaImage.fillAmount : (enemyCombatantInstance.maxMana > 0 ? (float)enemyCombatantInstance.currentMana / enemyCombatantInstance.maxMana : 0f);
if (currentEnemy_manaRate != null)
currentEnemy_manaRate.text = enemyCombatantInstance.maxMana > 0 ? $"{enemyCombatantInstance.currentMana}/{enemyCombatantInstance.maxMana}" : "0/0";
{
if (enemyCombatantInstance.maxMana > 0)
{
_sb.Clear();
_sb.Append(enemyCombatantInstance.currentMana).Append("/").Append(enemyCombatantInstance.maxMana);
currentEnemy_manaRate.text = _sb.ToString();
}
else
{
currentEnemy_manaRate.text = "0/0";
}
}
// Aggregate total health logic (modified to call the helper method for animation control)
UpdateAllEnemyTotalHealthUIImmediate();
}
private System.Text.StringBuilder _sb = new System.Text.StringBuilder();
private void UpdateEnemyHealthVisuals(int oldHP, int newHP, bool animateFade)
{
if (enemyCombatantInstance == null) return;
@@ -1652,7 +1691,11 @@ public class teamUIController : MonoBehaviour
currentEnemy_healthImage.fillAmount = Mathf.MoveTowards(currentEnemy_healthImage.fillAmount, newFill, 1f);
}
if (currentEnemy_healthRate != null)
currentEnemy_healthRate.text = $"{newHP}/{enemyCombatantInstance.maxHP}";
{
_sb.Clear();
_sb.Append(newHP).Append("/").Append(enemyCombatantInstance.maxHP);
currentEnemy_healthRate.text = _sb.ToString();
}
if (enemyFadeHealthCoroutine != null) StopCoroutine(enemyFadeHealthCoroutine);
if (currentEnemy_fadehealthImage != null)
@@ -1676,7 +1719,18 @@ public class teamUIController : MonoBehaviour
{
if (enemyCombatantInstance == null) return;
if (currentEnemy_manaRate != null)
currentEnemy_manaRate.text = enemyCombatantInstance.maxMana > 0 ? $"{newMana}/{enemyCombatantInstance.maxMana}" : "0/0";
{
if (enemyCombatantInstance.maxMana > 0)
{
_sb.Clear();
_sb.Append(newMana).Append("/").Append(enemyCombatantInstance.maxMana);
currentEnemy_manaRate.text = _sb.ToString();
}
else
{
currentEnemy_manaRate.text = "0/0";
}
}
if (enemyFadeManaCoroutine != null) StopCoroutine(enemyFadeManaCoroutine);
if (currentEnemy_fademanaImage != null)