You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.4 KiB
38 lines
1.4 KiB
3 years ago
|
using System.Reflection;
|
||
|
|
||
|
namespace ET
|
||
|
{
|
||
|
|
||
|
[MessageHandler]
|
||
|
public class M2C_RemoveEntityHandler : AMHandler<M2C_RemoveEntity>
|
||
|
{
|
||
|
protected override void Run(Session session, M2C_RemoveEntity message)
|
||
|
{
|
||
|
|
||
|
var unit = UnitComponent.unit;
|
||
|
switch (message.EntityType)
|
||
|
{
|
||
|
case ConstEntityType.ENTITY_GATHER:
|
||
|
unit.GetComponent<GatherComponent>().RemoveChildWithId(message.Id);
|
||
|
break;
|
||
|
case ConstEntityType.ENTITY_RESOURCE:
|
||
|
unit.GetComponent<ResourcePointComponent>().RemoveChildWithId(message.Id);
|
||
|
break;
|
||
|
case ConstEntityType.ENTITY_BUILDING:
|
||
|
unit.GetComponent<BuildingComponent>().RemoveChildWithId(message.Id);
|
||
|
break;
|
||
|
case ConstEntityType.ENTITY_PEOPLE:
|
||
|
unit.GetComponent<PeopleComponent>().RemoveChildWithId(message.Id);
|
||
|
break;
|
||
|
case ConstEntityType.ENTITY_ITEM:
|
||
|
unit.GetComponent<StoreComponent>().RemoveChildWithId(message.Id);
|
||
|
break;
|
||
|
case ConstEntityType.ENTITY_CONSTRUCT:
|
||
|
unit.GetComponent<ConstructComponent>().RemoveChildWithId(message.Id);
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|