You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
2.3 KiB
C#
96 lines
2.3 KiB
C#
using Entitas;
|
|
using System.Collections.Generic;
|
|
using Game;
|
|
public class EntityDestroySystem : IExecuteSystem, IInitializeSystem
|
|
{
|
|
private IGroup<GameEntity> _entities;
|
|
private List<GameEntity> _deleteEntities;
|
|
public void Initialize()
|
|
{
|
|
_entities = Util.GetGroup(GameMatcher.ID);
|
|
_deleteEntities = new List<GameEntity>();
|
|
}
|
|
public void Execute()
|
|
{
|
|
foreach (var entity in _entities)
|
|
{
|
|
if (entity.iD.Data.IsDestroy)
|
|
{
|
|
_deleteEntities.Add(entity);
|
|
}
|
|
}
|
|
foreach (var deleteEntity in _deleteEntities)
|
|
{
|
|
ResetComponent(deleteEntity);
|
|
deleteEntity.Destroy();
|
|
}
|
|
_deleteEntities.Clear();
|
|
}
|
|
public void ResetComponent(GameEntity entity)
|
|
{
|
|
var master = Util.GetMaster();
|
|
var entityId = entity.ID();
|
|
if (entity.hasID)
|
|
{
|
|
Util.ClearId(entity);
|
|
}
|
|
if (entity.hasView)
|
|
{
|
|
Util.ClearView(entity);
|
|
}
|
|
if (entity.hasMove)
|
|
{
|
|
Util.ClearMove(entity);
|
|
}
|
|
if (entity.hasTimeline)
|
|
{
|
|
Util.EndSkillTimeline(entity);
|
|
}
|
|
if (entity.hasCombo)
|
|
{
|
|
Util.ClearCombo(entity);
|
|
}
|
|
if (entity.hasSkill)
|
|
{
|
|
Util.ClearSkill(entity);
|
|
}
|
|
if (entity.hasHp)
|
|
{
|
|
Util.ClearHp(entity);
|
|
}
|
|
if (entity.hasAI)
|
|
{
|
|
Util.ClearAI(entity);
|
|
}
|
|
if (entity.hasBuff)
|
|
{
|
|
Util.ClearBuff(entity);
|
|
}
|
|
if (entity.hasBullet)
|
|
{
|
|
Util.ClearBullet(entity);
|
|
}
|
|
if (entity.hasPoint)
|
|
{
|
|
Util.ClearPoint(entity);
|
|
}
|
|
if (entity.hasMasterSoul)
|
|
{
|
|
Util.ClearMasterSoul(entity);
|
|
}
|
|
if (entity.hasInteract)
|
|
{
|
|
Util.ClearInteract(entity);
|
|
}
|
|
|
|
|
|
if (master.combo.TargetLock == entityId)
|
|
{
|
|
master.combo.TargetLock = 0;
|
|
}
|
|
if (master.combo.TargetLastLockTime.ContainsKey(entityId))
|
|
{
|
|
master.combo.TargetLastLockTime.Remove(entityId);
|
|
}
|
|
}
|
|
} |