feat: 무적 이상상태 기반 구르기 스킬 정리

- 무적 이상상태 데이터와 효과 에셋을 추가
- 구르기를 일반 스킬이 무적 상태를 부여하는 구조로 변경
- 대미지 처리와 플레이어 상태 판정이 무적 이상상태를 참조하도록 정리
This commit is contained in:
2026-03-19 19:16:32 +09:00
parent 0c26853b2a
commit 287ff4dc83
15 changed files with 166 additions and 55 deletions

View File

@@ -18,6 +18,9 @@ namespace Colosseum.Player
[Tooltip("CharacterStats 컴포넌트 (없으면 자동 검색)")]
[SerializeField] private CharacterStats characterStats;
[Tooltip("이상상태 관리자 (없으면 자동 검색)")]
[SerializeField] private AbnormalityManager abnormalityManager;
// 네트워크 동기화 변수
private NetworkVariable<float> currentHealth = new NetworkVariable<float>(100f);
private NetworkVariable<float> currentMana = new NetworkVariable<float>(50f);
@@ -50,6 +53,11 @@ namespace Colosseum.Player
characterStats = GetComponent<CharacterStats>();
}
if (abnormalityManager == null)
{
abnormalityManager = GetComponent<AbnormalityManager>();
}
// 네트워크 변수 변경 콜백 등록
currentHealth.OnValueChanged += HandleHealthChanged;
currentMana.OnValueChanged += HandleManaChanged;
@@ -93,7 +101,7 @@ namespace Colosseum.Player
[Rpc(SendTo.Server)]
public void TakeDamageRpc(float damage)
{
if (isDead.Value) return;
if (isDead.Value || IsDamageImmune()) return;
currentHealth.Value = Mathf.Max(0f, currentHealth.Value - damage);
@@ -159,7 +167,6 @@ namespace Colosseum.Player
isDead.Value = true;
// 사망 시 활성 이상 상태를 정리해 리스폰 시 잔존하지 않게 합니다.
var abnormalityManager = GetComponent<AbnormalityManager>();
if (abnormalityManager != null)
{
abnormalityManager.RemoveAllAbnormalities();
@@ -202,7 +209,6 @@ namespace Colosseum.Player
{
if (!IsServer) return;
var abnormalityManager = GetComponent<AbnormalityManager>();
if (abnormalityManager != null)
{
abnormalityManager.RemoveAllAbnormalities();
@@ -244,7 +250,7 @@ namespace Colosseum.Player
/// </summary>
public float TakeDamage(float damage, object source = null)
{
if (!IsServer || isDead.Value) return 0f;
if (!IsServer || isDead.Value || IsDamageImmune()) return 0f;
float actualDamage = Mathf.Min(damage, currentHealth.Value);
currentHealth.Value = Mathf.Max(0f, currentHealth.Value - damage);
@@ -269,6 +275,11 @@ namespace Colosseum.Player
return actualHeal;
}
private bool IsDamageImmune()
{
return abnormalityManager != null && abnormalityManager.IsInvincible;
}
#endregion
}
}