feat: 스테이지 1,2 맵 내의 추락 dead zone 지정 및 캐릭터 사망 시 UI 노출 이벤트 추가
This commit is contained in:
@@ -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(); // 사망 애니메이션 종료 시점에 이벤트 호출
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace TON
|
||||
{
|
||||
if (animator.TryGetComponent(out CharacterBase character))
|
||||
{
|
||||
character.Dead();
|
||||
character.DestroyDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
27
Gameton-06/Assets/Gameton/Scripts/GameStage/StageDeadZone.cs
Normal file
27
Gameton-06/Assets/Gameton/Scripts/GameStage/StageDeadZone.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TON
|
||||
{
|
||||
public class StageDeadZone : MonoBehaviour
|
||||
{
|
||||
private void OnTriggerEnter2D(Collider2D collision)
|
||||
{
|
||||
if (collision.CompareTag("Player"))
|
||||
{
|
||||
CharacterBase character = collision.gameObject.GetComponentInChildren<CharacterBase>();
|
||||
character.Dead();
|
||||
|
||||
character.OnDeathCompleted += ShowGameOverUI; // 이벤트 구독
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowGameOverUI()
|
||||
{
|
||||
UIManager.Show<GameoverUI>(UIList.GameOverUI);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 742e996d10bb93b4eab96a09af062282
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user