Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Pixeye committed Jun 23, 2019
1 parent 22d3ea4 commit 94875dc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
1 change: 1 addition & 0 deletions Runtime/LibEcs/Entity.Handle.Delayed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public enum Action : byte
Remove,
Kill,
KillFinalize,
Empty,
Activate,
Deactivate,
Unbind,
Expand Down
38 changes: 27 additions & 11 deletions Runtime/LibProcessors/ProcessorEntities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,21 +206,37 @@ public void Tick(float delta)
ref var components = ref Entity.components[entityID];
components.Remove(operation.arg);

// if (components.amount == 0)
// {
// if (Entity.transforms.Length > entityID && Entity.transforms[entityID] != null)
// {
// Entity.transforms[entityID].gameObject.Release(Entity.cache[entityID].isPooled ? Pool.Entities : 0);
// Entity.transforms[entityID] = null;
// }
//
// Entity.tags[entityID].Clear();
// EntityOperations.Set(operation.entity, 0, EntityOperations.Action.KillFinalize);
// }
if (components.amount == 0)
{
EntityOperations.Set(operation.entity, 0, EntityOperations.Action.Empty);
}

break;
}

case EntityOperations.Action.Empty:
{

if (!operation.entity.Exist) continue;

ref var components = ref Entity.components[entityID];

if (Entity.transforms.Length > entityID && Entity.transforms[entityID] != null)
{
Entity.transforms[entityID].gameObject.Release(Entity.cache[entityID].isPooled ? Pool.Entities : 0);
Entity.transforms[entityID] = null;
}

Entity.tags[entityID].Clear();
Entity.cache[entityID].isAlive = false;
Entity.Count--;

EntityOperations.Set(operation.entity, 0, EntityOperations.Action.KillFinalize);


break;
}

case EntityOperations.Action.ChangeTag:
{
if (!Entity.cache[entityID].isAlive) continue;
Expand Down

0 comments on commit 94875dc

Please sign in to comment.