CTT/Unity/Assets/HotfixView/Event/OnDisposeUnitEvent.cs

32 lines
876 B
C#
Raw Normal View History

2021-04-08 20:09:59 +08:00
using ET.EventType;
using ET;
using System;
using System.Collections.Generic;
namespace ET
{
public class OnDisposeUnitEvent : AEvent_Sync<OnDisposeUnit>
{
public override void Run(OnDisposeUnit args)
{
var unit = args.unit;
if (unit.UnitType == UnitType.NPC)
{
NPCHudComponent.Instance.Remove(unit);
}
else
if (unit.UnitType == UnitType.TransPoint)
return;
else
if (unit.UnitType == UnitType.SceneUnit)
return;
else
HudComponent.Instance.Remove(unit);
var unitView = unit.GetComponent<UnitView>();
var foot = unitView.footEffect?.gameObject;
if (foot != null)
ResourceViewHelper.DestoryPrefabAsync(foot);
}
}
}