Skip to content

Commit

Permalink
Change to deactivate entity instead of active.
Browse files Browse the repository at this point in the history
  • Loading branch information
isadorasophia committed Nov 18, 2023
1 parent 2ba780c commit 3607476
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Bang/Contexts/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ internal override void FilterEntity(Entity entity)

if (OnComponentAddedForEntityInContext is not null)
{
if (entity.IsActive)
if (!entity.IsDeactivated)
{
// TODO: Optimize this? We must notify all the reactive systems
// that the entity has been added.
Expand All @@ -293,7 +293,7 @@ internal override void FilterEntity(Entity entity)
entity.OnComponentAdded += OnComponentAddedForEntityInContext;
}

if (entity.IsActive)
if (!entity.IsDeactivated)
{
_entities[entity.EntityId] = entity;
_cachedEntities = null;
Expand Down Expand Up @@ -458,7 +458,7 @@ private void StopWatchingEntity(Entity e, int index, bool causedByDestroy)
e.OnEntityActivated -= OnEntityActivated;
e.OnEntityDeactivated -= OnEntityDeactivated;

if (e.IsActive)
if (!e.IsDeactivated)
{
// Notify immediately of the removed component.
OnComponentRemovedForEntityInContext?.Invoke(e, index, causedByDestroy);
Expand Down

0 comments on commit 3607476

Please sign in to comment.