MoonTools.ECS/src/EntityStorage.cs

23 lines
359 B
C#
Raw Normal View History

2022-04-08 05:52:03 +00:00
namespace MoonTools.ECS
2022-03-05 02:01:44 +00:00
{
2022-04-08 05:52:03 +00:00
internal class EntityStorage
2022-03-05 02:01:44 +00:00
{
2022-04-08 05:52:03 +00:00
public IDStorage idStorage = new IDStorage();
2022-03-05 02:01:44 +00:00
2022-04-08 05:52:03 +00:00
public Entity Create()
{
return new Entity(idStorage.NextID());
}
2022-04-08 05:52:03 +00:00
public bool Exists(in Entity entity)
{
return idStorage.Taken(entity.ID);
}
public void Destroy(in Entity entity)
{
idStorage.Release(entity.ID);
}
2022-03-05 02:01:44 +00:00
}
}