Add player action state and abnormality debug workflow

This commit is contained in:
2026-03-19 18:21:39 +09:00
parent d39e13f032
commit 12e37dc1c7
23 changed files with 1286 additions and 25 deletions

View File

@@ -1,8 +1,11 @@
using System;
using UnityEngine;
using Unity.Netcode;
using Colosseum.Abnormalities;
using Colosseum.Stats;
using Colosseum.Combat;
using Colosseum.Skills;
namespace Colosseum.Player
{
@@ -33,6 +36,7 @@ namespace Colosseum.Player
// 사망 이벤트
public event Action<PlayerNetworkController> OnDeath;
public event Action<bool> OnDeathStateChanged; // (isDead)
public event Action<PlayerNetworkController> OnRespawned;
// IDamageable 구현
public float CurrentHealth => currentHealth.Value;
@@ -105,6 +109,8 @@ namespace Colosseum.Player
[Rpc(SendTo.Server)]
public void UseManaRpc(float amount)
{
if (isDead.Value) return;
currentMana.Value = Mathf.Max(0f, currentMana.Value - amount);
}
@@ -114,6 +120,8 @@ namespace Colosseum.Player
[Rpc(SendTo.Server)]
public void RestoreHealthRpc(float amount)
{
if (isDead.Value) return;
currentHealth.Value = Mathf.Min(MaxHealth, currentHealth.Value + amount);
}
@@ -123,6 +131,8 @@ namespace Colosseum.Player
[Rpc(SendTo.Server)]
public void RestoreManaRpc(float amount)
{
if (isDead.Value) return;
currentMana.Value = Mathf.Min(MaxMana, currentMana.Value + amount);
}
@@ -148,6 +158,13 @@ namespace Colosseum.Player
isDead.Value = true;
// 사망 시 활성 이상 상태를 정리해 리스폰 시 잔존하지 않게 합니다.
var abnormalityManager = GetComponent<AbnormalityManager>();
if (abnormalityManager != null)
{
abnormalityManager.RemoveAllAbnormalities();
}
// 이동 비활성화
var movement = GetComponent<PlayerMovement>();
if (movement != null)
@@ -162,6 +179,13 @@ namespace Colosseum.Player
skillInput.enabled = false;
}
// 실행 중인 스킬 즉시 취소
var skillController = GetComponent<SkillController>();
if (skillController != null)
{
skillController.CancelSkill();
}
// 모든 클라이언트에서 사망 애니메이션 재생
PlayDeathAnimationRpc();
@@ -178,6 +202,12 @@ namespace Colosseum.Player
{
if (!IsServer) return;
var abnormalityManager = GetComponent<AbnormalityManager>();
if (abnormalityManager != null)
{
abnormalityManager.RemoveAllAbnormalities();
}
isDead.Value = false;
currentHealth.Value = MaxHealth;
currentMana.Value = MaxMana;
@@ -203,6 +233,8 @@ namespace Colosseum.Player
animator.Rebind();
}
OnRespawned?.Invoke(this);
Debug.Log($"[Player] Player {OwnerClientId} respawned!");
}