gameplay所有基本功能都装了,加入了全局警告。加入飘字等各种东西。
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using System.Collections.Generic;
|
||||
@@ -43,7 +43,7 @@ public class teamUIController : MonoBehaviour
|
||||
// Documentation text normalized.
|
||||
private EnemyData_SO[] currentEnemySOs = new EnemyData_SO[0];
|
||||
// Documentation text normalized.
|
||||
private EnemyData_SO[] recognizedEnemySOs = new EnemyData_SO[0];
|
||||
public EnemyData_SO[] recognizedEnemySOs = new EnemyData_SO[0];
|
||||
|
||||
// previous active flags for detecting external changes
|
||||
private bool[] prevAllyActive = new bool[5];
|
||||
@@ -705,7 +705,8 @@ public class teamUIController : MonoBehaviour
|
||||
{
|
||||
if (so != null)
|
||||
{
|
||||
list.Add(so);
|
||||
var cloned = Instantiate(so);
|
||||
list.Add(cloned);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1432,7 +1433,8 @@ public class teamUIController : MonoBehaviour
|
||||
enemyCombatantInstance.InitializeFromSO(so);
|
||||
|
||||
// set UI visuals (name / sprites)
|
||||
if (currentEnemy_nameText != null) currentEnemy_nameText.text = so.enemyName ?? so.name;
|
||||
string enemyName = so.enemyName ?? so.name;
|
||||
if (currentEnemy_nameText != null) currentEnemy_nameText.text = enemyName;
|
||||
if (currentEnemy_characterImage != null)
|
||||
{
|
||||
var sprite = so.enemy_Profile != null ? so.enemy_Profile : so.enemy_Image;
|
||||
@@ -1440,6 +1442,9 @@ public class teamUIController : MonoBehaviour
|
||||
else currentEnemy_characterImage.sprite = null;
|
||||
}
|
||||
|
||||
// Push spawn message to feed
|
||||
SkillTriggerFeedUI.PushEnemySpawn(enemyName);
|
||||
|
||||
// set type text: show for Simple/Elite/Boss/Legend
|
||||
if (currentEnemy_typeText != null)
|
||||
{
|
||||
@@ -1593,6 +1598,21 @@ public class teamUIController : MonoBehaviour
|
||||
|
||||
private void OnEnemyDiedHandler(EnemyCombatant e)
|
||||
{
|
||||
// Push death message to feed before advancing
|
||||
string eName = "Unknown Enemy";
|
||||
if (enemyCurrentCount >= 0 && enemyCurrentCount < recognizedEnemySOs.Length)
|
||||
{
|
||||
var so = recognizedEnemySOs[enemyCurrentCount];
|
||||
if (so != null) eName = so.enemyName ?? so.name;
|
||||
}
|
||||
SkillTriggerFeedUI.PushEnemyDeath(eName);
|
||||
|
||||
// notify enemy ball UI
|
||||
if (BeatmapManager.Instance != null && BeatmapManager.Instance.enemyBallLoader != null)
|
||||
{
|
||||
BeatmapManager.Instance.enemyBallLoader.OnEnemyDefeated();
|
||||
}
|
||||
|
||||
// advance to next enemy after death
|
||||
enemyCurrentCount++;
|
||||
SpawnNextEnemy();
|
||||
@@ -1614,34 +1634,46 @@ public class teamUIController : MonoBehaviour
|
||||
/// </summary>
|
||||
public void ApplyCalculatedEnemyHP(int individualMaxHP)
|
||||
{
|
||||
// Documentation text normalized.
|
||||
if (recognizedEnemySOs != null && recognizedEnemySOs.Length > 0)
|
||||
List<int> hpList = new List<int>();
|
||||
if (recognizedEnemySOs != null)
|
||||
{
|
||||
Debug.Log($"[teamUIController] Applying calculated HP: {individualMaxHP} to {recognizedEnemySOs.Length} recognized enemies.");
|
||||
|
||||
// Documentation text normalized.
|
||||
foreach (var so in recognizedEnemySOs)
|
||||
for (int i = 0; i < recognizedEnemySOs.Length; i++)
|
||||
{
|
||||
// Documentation text normalized.
|
||||
hpList.Add(individualMaxHP);
|
||||
}
|
||||
}
|
||||
ApplyCalculatedEnemyHP(hpList);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply individual HP values to enemies.
|
||||
/// </summary>
|
||||
public void ApplyCalculatedEnemyHP(List<int> individualHPList)
|
||||
{
|
||||
if (recognizedEnemySOs != null && recognizedEnemySOs.Length > 0 && individualHPList != null)
|
||||
{
|
||||
Debug.Log($"[teamUIController] Applying calculated HP list to {recognizedEnemySOs.Length} recognized enemies.");
|
||||
|
||||
for (int i = 0; i < recognizedEnemySOs.Length; i++)
|
||||
{
|
||||
var so = recognizedEnemySOs[i];
|
||||
if (so != null)
|
||||
{
|
||||
so.enemy_maxHP = individualMaxHP;
|
||||
int newHP = (i < individualHPList.Count) ? individualHPList[i] : 0;
|
||||
so.enemy_maxHP = newHP;
|
||||
}
|
||||
}
|
||||
|
||||
// Documentation text normalized.
|
||||
RecalculateTotalMaxHP();
|
||||
|
||||
// Documentation text normalized.
|
||||
// Documentation text normalized.
|
||||
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); // Documentation text normalized.
|
||||
UpdateEnemyUIImmediate(); // Documentation text normalized.
|
||||
Debug.Log($"[teamUIController] Re-initializing current enemy instance with new HP: {currentSO.enemy_maxHP}");
|
||||
enemyCombatantInstance.InitializeFromSO(currentSO);
|
||||
UpdateEnemyUIImmediate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1709,8 +1741,8 @@ public class teamUIController : MonoBehaviour
|
||||
|
||||
// Documentation text normalized.
|
||||
allEnemy_totalHealthImage.fillAmount = newFill;
|
||||
SetBarScaleY(allEnemy_totalHealthImage, newFill);
|
||||
SetBarScaleY(allEnemy_totalHealthImage, newFill);
|
||||
// SetBarScaleY(allEnemy_totalHealthImage, newFill);
|
||||
// SetBarScaleY(allEnemy_totalHealthImage, newFill);
|
||||
if (totalEnemy_healthRate != null)
|
||||
{
|
||||
_sb.Clear();
|
||||
@@ -1721,7 +1753,8 @@ public class teamUIController : MonoBehaviour
|
||||
// 2. Animate fade bar (only when health decreases)
|
||||
if (allEnemy_totalFadehealthImage != null)
|
||||
{
|
||||
float currentFadeFill = GetBarScaleY(allEnemy_totalFadehealthImage);
|
||||
// float currentFadeFill = GetBarScaleY(allEnemy_totalFadehealthImage);
|
||||
float currentFadeFill = allEnemy_totalFadehealthImage.fillAmount;
|
||||
|
||||
if (currentFadeFill > newFill)
|
||||
{
|
||||
@@ -1732,7 +1765,7 @@ public class teamUIController : MonoBehaviour
|
||||
else
|
||||
{
|
||||
allEnemy_totalFadehealthImage.fillAmount = newFill;
|
||||
SetBarScaleY(allEnemy_totalFadehealthImage, newFill);
|
||||
// SetBarScaleY(allEnemy_totalFadehealthImage, newFill);
|
||||
}
|
||||
}
|
||||
else if (currentFadeFill < newFill)
|
||||
@@ -1740,7 +1773,7 @@ public class teamUIController : MonoBehaviour
|
||||
// Health increased (healing): update fade bar immediately
|
||||
if (totalFadeHealthCoroutine != null) StopCoroutine(totalFadeHealthCoroutine);
|
||||
allEnemy_totalFadehealthImage.fillAmount = newFill;
|
||||
SetBarScaleY(allEnemy_totalFadehealthImage, newFill);
|
||||
// SetBarScaleY(allEnemy_totalFadehealthImage, newFill);
|
||||
}
|
||||
// If currentFadeFill == newFill, do nothing.
|
||||
}
|
||||
@@ -1780,7 +1813,7 @@ public class teamUIController : MonoBehaviour
|
||||
if (allEnemy_totalFadehealthImage != null)
|
||||
{
|
||||
allEnemy_totalFadehealthImage.fillAmount = newFill;
|
||||
SetBarScaleY(allEnemy_totalFadehealthImage, newFill);
|
||||
// SetBarScaleY(allEnemy_totalFadehealthImage, newFill);
|
||||
}
|
||||
if (totalEnemy_healthRate != null)
|
||||
{
|
||||
@@ -2004,7 +2037,8 @@ public class teamUIController : MonoBehaviour
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
if (allEnemy_totalFadehealthImage == null) yield break;
|
||||
|
||||
float start = GetBarScaleY(allEnemy_totalFadehealthImage);
|
||||
// float start = GetBarScaleY(allEnemy_totalFadehealthImage);
|
||||
float start = allEnemy_totalFadehealthImage.fillAmount;
|
||||
float duration = 0.6f;
|
||||
float t = 0f;
|
||||
while (t < duration)
|
||||
@@ -2012,11 +2046,11 @@ public class teamUIController : MonoBehaviour
|
||||
t += Time.deltaTime;
|
||||
float y = Mathf.Lerp(start, targetFill, t / duration);
|
||||
allEnemy_totalFadehealthImage.fillAmount = y;
|
||||
SetBarScaleY(allEnemy_totalFadehealthImage, y);
|
||||
// SetBarScaleY(allEnemy_totalFadehealthImage, y);
|
||||
yield return null;
|
||||
}
|
||||
allEnemy_totalFadehealthImage.fillAmount = targetFill;
|
||||
SetBarScaleY(allEnemy_totalFadehealthImage, targetFill);
|
||||
// SetBarScaleY(allEnemy_totalFadehealthImage, targetFill);
|
||||
}
|
||||
|
||||
// Documentation text normalized.
|
||||
|
||||
Reference in New Issue
Block a user