diff --git a/encompass-cs/Engine.cs b/encompass-cs/Engine.cs
index 4bea453..6d1fc6b 100644
--- a/encompass-cs/Engine.cs
+++ b/encompass-cs/Engine.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Reflection;
using System.Collections.Generic;
using System.Linq;
@@ -151,17 +151,6 @@ namespace Encompass
return entityManager.EntityExists(entity.ID);
}
- ///
- /// Returns the Entity with the specified ID.
- ///
- ///
- /// Thrown when an Entity with the given ID does not exist.
- ///
- internal Entity GetEntity(Guid entityID)
- {
- return entityManager.GetEntity(entityID);
- }
-
///
/// Returns an Entity containing the specified Component type.
///
diff --git a/encompass-cs/EntityManager.cs b/encompass-cs/EntityManager.cs
index 0d89fa3..b3c700b 100644
--- a/encompass-cs/EntityManager.cs
+++ b/encompass-cs/EntityManager.cs
@@ -1,4 +1,4 @@
-using System.Linq;
+using System.Linq;
using System;
using System.Collections.Generic;
using Encompass.Exceptions;
@@ -7,7 +7,7 @@ namespace Encompass
{
internal class EntityManager
{
- private readonly Dictionary IDToEntity = new Dictionary(1024);
+ private readonly HashSet IDs = new HashSet();
private readonly HashSet entitiesMarkedForDestroy = new HashSet();
@@ -22,25 +22,13 @@ namespace Encompass
{
var id = NextID();
var entity = new Entity(id);
- IDToEntity[id] = entity;
+ IDs.Add(id);
return entity;
}
public bool EntityExists(Guid id)
{
- return IDToEntity.ContainsKey(id);
- }
-
- public Entity GetEntity(Guid id)
- {
- if (IDToEntity.ContainsKey(id))
- {
- return IDToEntity[id];
- }
- else
- {
- throw new EntityNotFoundException("Entity with ID {0} does not exist.", id);
- }
+ return IDs.Contains(id);
}
public void MarkForDestroy(Entity entity)
@@ -53,7 +41,7 @@ namespace Encompass
foreach (var entity in entitiesMarkedForDestroy)
{
componentManager.MarkAllComponentsOnEntityForRemoval(entity);
- IDToEntity.Remove(entity.ID);
+ IDs.Remove(entity.ID);
}
entitiesMarkedForDestroy.Clear();
diff --git a/encompass-cs/Renderer.cs b/encompass-cs/Renderer.cs
index e14a8c8..b58dd39 100644
--- a/encompass-cs/Renderer.cs
+++ b/encompass-cs/Renderer.cs
@@ -19,11 +19,6 @@ namespace Encompass
this.componentManager = componentManager;
}
- internal Entity GetEntity(Guid entityID)
- {
- return entityManager.GetEntity(entityID);
- }
-
protected IEnumerable ReadEntities() where TComponent : struct, IComponent
{
return ReadComponentsIncludingEntity().Select(tuple => tuple.Item2);