Skip to content

Commit

Permalink
Yet another quad tree system on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
saint11 committed Dec 19, 2024
1 parent 72d5f2b commit 8d87521
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Murder/Systems/Physics/QuadtreeCalculatorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Murder.Systems;

[Filter(typeof(ColliderComponent), typeof(ITransformComponent))]
[Watch(typeof(ITransformComponent), typeof(ColliderComponent))]
public class QuadtreeCalculatorSystem : IReactiveSystem, IFixedUpdateSystem
public class QuadtreeCalculatorSystem : IReactiveSystem, IFixedUpdateSystem, IStartupSystem
{
private readonly HashSet<int> _entitiesOnWatch = new(516);

Expand Down Expand Up @@ -82,4 +82,12 @@ public void FixedUpdate(Context context)

_entitiesOnWatch.Clear();
}

public void Start(Context context)
{
for (int i = 0; i < context.Entities.Length; i++)
{
_entitiesOnWatch.Add(context.Entities[i].EntityId);
}
}
}

0 comments on commit 8d87521

Please sign in to comment.