修复一堆bug 加入粒子系统代替原击打特效 焕新长音符逻辑 修复多重计分 更新判定管理和音符生成器 搞了一个免费包
This commit is contained in:
@@ -603,13 +603,12 @@ public class teamUIController : MonoBehaviour
|
||||
|
||||
// Calculate total max HP for all recognized enemies
|
||||
// Note: totalMaxHP is a class member and is intended to be the fixed maximum HP for the entire encounter.
|
||||
totalMaxHP = 0;
|
||||
if (recognizedEnemySOs != null)
|
||||
RecalculateTotalMaxHP();
|
||||
|
||||
if (recognizedEnemySOs.Length > 0)
|
||||
{
|
||||
foreach (var so in recognizedEnemySOs)
|
||||
{
|
||||
if (so != null) totalMaxHP += so.enemy_maxHP;
|
||||
}
|
||||
enemyCurrentCount = 0;
|
||||
SpawnNextEnemy();
|
||||
}
|
||||
|
||||
// If enemies were populated and we have some, start spawning from the beginning
|
||||
@@ -681,7 +680,9 @@ public class teamUIController : MonoBehaviour
|
||||
[Tooltip("当前总分")]
|
||||
public TextMeshProUGUI currentTotalScore;
|
||||
[Header("谱面总分")]
|
||||
public TextMeshProUGUI allSum_pmScore;
|
||||
public TextMeshProUGUI allSum_pmScore;
|
||||
[Header("爱豆总分")]
|
||||
public TextMeshProUGUI allSum_idolScore;
|
||||
|
||||
// new: runtime enemy instance and UI sync fields
|
||||
private EnemyCombatant enemyCombatantInstance;
|
||||
@@ -743,6 +744,8 @@ public class teamUIController : MonoBehaviour
|
||||
[SerializeField] private int teammate01_maxMana;
|
||||
[Header("pmScore")]
|
||||
public TextMeshProUGUI red_pmScore_sum;
|
||||
[Header("idolScore")]
|
||||
public TextMeshProUGUI red_idolScore_sum;
|
||||
|
||||
[Header("teammate02")]
|
||||
[Tooltip("父物体-控制整体显隐")]
|
||||
@@ -779,6 +782,8 @@ public class teamUIController : MonoBehaviour
|
||||
[SerializeField] private int teammate02_maxMana;
|
||||
[Header("pmScore")]
|
||||
public TextMeshProUGUI green_pmScore_sum;
|
||||
[Header("idolScore")]
|
||||
public TextMeshProUGUI green_idolScore_sum;
|
||||
|
||||
[Header("teammate03")]
|
||||
[Tooltip("父物体-控制整体显隐")]
|
||||
@@ -815,6 +820,8 @@ public class teamUIController : MonoBehaviour
|
||||
[SerializeField] private int teammate03_maxMana;
|
||||
[Header("pmScore")]
|
||||
public TextMeshProUGUI yellow_pmScore_sum;
|
||||
[Header("idolScore")]
|
||||
public TextMeshProUGUI yellow_idolScore_sum;
|
||||
|
||||
[Header("teammate04")]
|
||||
[Tooltip("父物体-控制整体显隐")]
|
||||
@@ -851,6 +858,8 @@ public class teamUIController : MonoBehaviour
|
||||
[SerializeField] private int teammate04_maxMana;
|
||||
[Header("pmScore")]
|
||||
public TextMeshProUGUI purple_pmScore_sum;
|
||||
[Header("idolScore")]
|
||||
public TextMeshProUGUI purple_idolScore_sum;
|
||||
|
||||
[Header("teammate05")]
|
||||
[Tooltip("父物体-控制整体显隐")]
|
||||
@@ -887,6 +896,8 @@ public class teamUIController : MonoBehaviour
|
||||
[SerializeField] private int teammate05_maxMana;
|
||||
[Header("pmScore")]
|
||||
public TextMeshProUGUI blue_pmScore_sum;
|
||||
[Header("idolScore")]
|
||||
public TextMeshProUGUI blue_idolScore_sum;
|
||||
|
||||
[Header("currentEnemy")]
|
||||
[Tooltip("父物体-控制整体显隐")]
|
||||
@@ -1388,6 +1399,70 @@ public class teamUIController : MonoBehaviour
|
||||
UpdateEnemyUIImmediate();
|
||||
}
|
||||
|
||||
// teamUIController.cs - 【新增】
|
||||
|
||||
// =========================================================
|
||||
// 供 BeatmapManager 调用的方法:设置单个敌人 HP
|
||||
// =========================================================
|
||||
/// <summary>
|
||||
/// 将计算得到的单个敌人最大生命值写入到所有已识别的敌人 Scriptable Object 中。
|
||||
/// </summary>
|
||||
public void ApplyCalculatedEnemyHP(int individualMaxHP)
|
||||
{
|
||||
// 确保 recognizedEnemySOs 数组不为空
|
||||
if (recognizedEnemySOs != null && recognizedEnemySOs.Length > 0)
|
||||
{
|
||||
Debug.Log($"[teamUIController] Applying calculated HP: {individualMaxHP} to {recognizedEnemySOs.Length} recognized enemies.");
|
||||
|
||||
// 1. 修改 SO 数据:遍历所有已识别的敌人 SO,并设置其最大生命值
|
||||
foreach (var so in recognizedEnemySOs)
|
||||
{
|
||||
// 假设 EnemyData_SO 包含 public int enemy_maxHP; 字段
|
||||
if (so != null)
|
||||
{
|
||||
so.enemy_maxHP = individualMaxHP;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 重新计算总血量并更新总血条
|
||||
RecalculateTotalMaxHP();
|
||||
|
||||
// 3. 强制刷新当前生成的敌人实例
|
||||
// 因为 Populate 已经在 Apply 之前生成了旧数据的敌人,所以需要重置
|
||||
if (enemyCombatantInstance != null && enemyCurrentCount >= 0 && enemyCurrentCount < recognizedEnemySOs.Length)
|
||||
{
|
||||
var currentSO = recognizedEnemySOs[enemyCurrentCount];
|
||||
if (currentSO != null)
|
||||
{
|
||||
Debug.Log($"[teamUIController] Re-initializing current enemy instance with new HP: {individualMaxHP}");
|
||||
enemyCombatantInstance.InitializeFromSO(currentSO); // 重新使用新的 SO 数据初始化实例
|
||||
UpdateEnemyUIImmediate(); // 立即刷新 UI
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// =========================================================
|
||||
// 【新增】总生命值重新计算方法(封装原有的累加逻辑)
|
||||
// =========================================================
|
||||
/// <summary>
|
||||
/// 遍历所有已识别敌人的 SO,累加它们的生命值,更新 totalMaxHP,并立即刷新总血条。
|
||||
/// </summary>
|
||||
private void RecalculateTotalMaxHP()
|
||||
{
|
||||
totalMaxHP = 0;
|
||||
if (recognizedEnemySOs != null)
|
||||
{
|
||||
foreach (var so in recognizedEnemySOs)
|
||||
{
|
||||
if (so != null) totalMaxHP += so.enemy_maxHP;
|
||||
}
|
||||
}
|
||||
Debug.Log($"[teamUIController] Total Max HP has been recalculated to: {totalMaxHP}");
|
||||
// 刷新总血条上限显示,防止出现延迟
|
||||
UpdateAllEnemyTotalHealthUIImmediate();
|
||||
}
|
||||
|
||||
// 新增:在当前敌人 HP 变化时,更新总血条 UI
|
||||
private void UpdateAllEnemyTotalHealthUIOnHpChange(int newCurrentHP)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user