zxl
/
CTT
forked from Cal/CTT
1
0
Fork 0
CTT/Unity/Assets/HotfixView/Event/OnDisposeUnitEvent.cs

33 lines
908 B
C#

using ET.EventType;
using ET;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace ET
{
public class OnDisposeUnitEvent : AEvent_Sync<OnDisposeUnit>
{
public override void Run(OnDisposeUnit args)
{
Unit 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);
UnitView unitView = unit.GetComponent<UnitView>();
GameObject foot = unitView.footEffect?.gameObject;
if (foot != null)
ResourceViewHelper.DestoryPrefabAsync(foot);
}
}
}