diff --git a/encompass-cs/ComponentManager.cs b/encompass-cs/ComponentManager.cs index 2e386ee..d880e31 100644 --- a/encompass-cs/ComponentManager.cs +++ b/encompass-cs/ComponentManager.cs @@ -89,14 +89,14 @@ namespace Encompass internal IEnumerable> GetActiveComponentsByType() where TComponent : struct, IComponent { return typeToComponentIDs.ContainsKey(typeof(TComponent)) ? - typeToComponentIDs[typeof(TComponent)].Select((id) => new ValueTuple(id, (TComponent)IDToComponent[id])) : + typeToComponentIDs[typeof(TComponent)].Intersect(activeComponents).Select((id) => new ValueTuple(id, (TComponent)IDToComponent[id])) : Enumerable.Empty>(); } internal IEnumerable> GetActiveComponentsByType(Type type) { return typeToComponentIDs.ContainsKey(type) ? - typeToComponentIDs[type].Select((id) => new ValueTuple(id, IDToComponent[id])) : + typeToComponentIDs[type].Intersect(activeComponents).Select((id) => new ValueTuple(id, IDToComponent[id])) : Enumerable.Empty>(); } diff --git a/encompass-cs/encompass-cs.csproj b/encompass-cs/encompass-cs.csproj index 314a007..f9a9ef5 100644 --- a/encompass-cs/encompass-cs.csproj +++ b/encompass-cs/encompass-cs.csproj @@ -4,7 +4,7 @@ netstandard2.0 Encompass EncompassECS.Framework - 0.6.1 + 0.6.2 Evan Hemsley true Moonside Games diff --git a/test/EngineTest.cs b/test/EngineTest.cs index 88b58ec..f34bb65 100644 --- a/test/EngineTest.cs +++ b/test/EngineTest.cs @@ -51,6 +51,9 @@ namespace Tests var componentAID = entity.AddComponent(mockComponent); var componentBID = entity.AddComponent(mockComponentB); + var inactiveComponentAID = entity.AddComponent(mockComponent); + + entity.DeactivateComponent(inactiveComponentAID); var world = worldBuilder.Build(); @@ -59,6 +62,7 @@ namespace Tests var resultComponentValues = resultComponents.Select((kv) => kv.Item2); resultComponentValues.Should().Contain(mockComponent); resultComponentValues.Should().Contain(mockComponentB); + resultComponents.Should().NotContain((inactiveComponentAID, mockComponent)); } [Test]