2023-08-22 19:08:45 +08:00
|
|
|
using Framework;
|
2023-12-13 16:20:41 +08:00
|
|
|
using Gameplay.Unit;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
|
|
|
namespace Gameplay.Level
|
|
|
|
|
{
|
|
|
|
|
public partial class Level
|
|
|
|
|
{
|
|
|
|
|
private void RegisterAllEvent()
|
|
|
|
|
{
|
|
|
|
|
EventManager.Instance.Register<GameUnit>(EventManager.EventName.INFIGHT_UNIT_DEAD, _OnUnitDead);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void UnRegisterAllEvent()
|
|
|
|
|
{
|
|
|
|
|
EventManager.Instance.Unregister<GameUnit>(EventManager.EventName.INFIGHT_UNIT_DEAD, _OnUnitDead);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void _OnUnitDead(GameUnit unit)
|
|
|
|
|
{
|
|
|
|
|
var level = LevelManager.Instance.CurrentLevel;
|
|
|
|
|
if (level == null) return;
|
|
|
|
|
if (level.selectUnit == unit)
|
|
|
|
|
{
|
|
|
|
|
level.UnSelectUnit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|