feat: 스테이지 1,2 맵 내의 추락 dead zone 지정 및 캐릭터 사망 시 UI 노출 이벤트 추가

This commit is contained in:
aube.lee
2025-02-20 14:22:59 +09:00
parent 2ba06148a1
commit bd76108c59
6 changed files with 231 additions and 5 deletions

View File

@@ -35,6 +35,7 @@ namespace TON
// ingame UI의 캐릭터 stat 적용을 위한 이벤트
public event System.Action<float, float> OnHPChanged;
public event System.Action<float, float> OnSPChanged;
public event System.Action OnDeathCompleted; // 사망 애니메이션 종료 이벤트
public void Start()
@@ -226,7 +227,7 @@ namespace TON
// 체력이 0 아래로 떨어지고 현 상태가 IsAlive 일때만 동작하도록 함
if (currentHP <= 0f && prevHP > 0)
{
animator.SetTrigger("Dead Trigger");
Dead();
}
// 체력이 0 보다 클때만 피격 모션 실행
@@ -241,8 +242,13 @@ namespace TON
public void Dead()
{
gameObject.SetActive(false);
animator.SetTrigger("Dead Trigger");
}
public void DestroyDead()
{
gameObject.SetActive(false);
OnDeathCompleted?.Invoke(); // 사망 애니메이션 종료 시점에 이벤트 호출
}
}
}

View File

@@ -15,7 +15,7 @@ namespace TON
{
if (animator.TryGetComponent(out CharacterBase character))
{
character.Dead();
character.DestroyDead();
}
}
}