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

33 lines
908 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;
2021-04-11 19:50:39 +08:00
using UnityEngine;
2021-04-08 20:09:59 +08:00
namespace ET
{
public class OnDisposeUnitEvent : AEvent_Sync<OnDisposeUnit>
{
public override void Run(OnDisposeUnit args)
{
2021-04-11 19:50:39 +08:00
Unit unit = args.unit;
2021-04-08 20:09:59 +08:00
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);
2021-04-11 19:50:39 +08:00
UnitView unitView = unit.GetComponent<UnitView>();
GameObject foot = unitView.footEffect?.gameObject;
2021-04-08 20:09:59 +08:00
if (foot != null)
ResourceViewHelper.DestoryPrefabAsync(foot);
}
}
}