Projext/Assets/00001.Scripts/EnemyRoomLink.cs
2026-02-22 22:37:34 +09:00

31 lines
613 B
C#

using UnityEngine;
public class EnemyRoomLink : MonoBehaviour
{
private CombatRoomController room;
void Awake()
{
room = GetComponentInParent<CombatRoomController>();
if (room != null)
room.RegisterEnemy(this);
else
Debug.LogWarning("EnemyRoomLink: 상위에 CombatRoomController를 못 찾았어요!");
}
void Update()
{
// 테스트: K 키로 죽이기
if (Input.GetKeyDown(KeyCode.K))
Die();
}
void Die()
{
if (room != null)
room.NotifyEnemyDied(this);
Destroy(gameObject);
}
}