替换玩家模型素材,添加 ChildrenMap 配置挂点

This commit is contained in:
2026-10-04 17:57:16 +08:00
parent 75ec52f3d4
commit aaa8cf3ee2
98 changed files with 6483 additions and 274 deletions
@@ -23,6 +23,7 @@ namespace SepCore.DebugPanel
private const float CornerTapWindow = 0.6f;
private const int RequiredCornerTapCount = 3;
private const int DebugHealAmount = 200;
private const string PlayerHealthChildKey = "Health";
[Header("Window Content")]
[SerializeField] private bool _showBuffSection = true;
@@ -235,7 +236,7 @@ namespace SepCore.DebugPanel
GUILayout.Label("Battle Debug");
ProcedureGame procedure = GameEntry.Procedure.CurrentProcedure as ProcedureGame;
Player player = FindPlayer();
HealthComponent playerHealth = player != null ? player.GetComponent<HealthComponent>() : null;
HealthComponent playerHealth = GetPlayerHealth(player);
if (procedure == null)
{
@@ -440,12 +441,39 @@ namespace SepCore.DebugPanel
Player player = FindPlayer();
if (player == null) return;
HealthComponent playerHealth = player.GetComponent<HealthComponent>();
HealthComponent playerHealth = GetPlayerHealth(player);
if (playerHealth == null) return;
RestorePlayerHealthToMax(playerHealth);
}
private static HealthComponent GetPlayerHealth(Player player)
{
if (player == null)
{
return null;
}
ChildrenMap childrenMap = player.GetComponent<ChildrenMap>();
if (childrenMap != null)
{
GameObject healthObject = childrenMap.Get(PlayerHealthChildKey);
if (healthObject != null)
{
HealthComponent healthComponent = healthObject.GetComponent<HealthComponent>();
if (healthComponent != null)
{
return healthComponent;
}
}
}
return player.GetComponent<HealthComponent>();
}
private static void AddPlayerHealth(HealthComponent playerHealth, int amount)
{
if (playerHealth == null) return;
if (amount <= 0) return;
if (playerHealth.CurrentHealth <= 0) return;
@@ -461,6 +489,7 @@ namespace SepCore.DebugPanel
private static void RestorePlayerHealthToMax(HealthComponent playerHealth)
{
if (playerHealth == null) return;
if (playerHealth.CurrentHealth <= 0) return;
int maxHealth = playerHealth.MaxHealth;
@@ -472,6 +501,7 @@ namespace SepCore.DebugPanel
private static void PublishPlayerHealthChanged(HealthComponent playerHealth)
{
if (playerHealth == null) return;
GameEntry.Event.Fire(null,
PlayerHealthChangeEventArgs.Create(0, playerHealth.CurrentHealth, playerHealth.MaxHealth));
}