Browse Source

Getting closer to the final design of the EntityStreams

Added the concept of QueryUniqueEntity, but don't rely on it, I am still making up my mind on it. If I keep it, it will be confined to EntityStructs only
Added more ECS common components
tags/2.8
sebas77 5 years ago
parent
commit
1a9a2e879e
23 changed files with 269 additions and 97 deletions
  1. +1
    -1
      Svelto.Common
  2. +1
    -2
      Svelto.ECS/Common/Components/ECSVector2.cs
  3. +14
    -0
      Svelto.ECS/Common/Components/ECSVector3.cs
  4. +15
    -0
      Svelto.ECS/Common/Components/EcsVector4.cs
  5. +36
    -0
      Svelto.ECS/Common/Components/ExtensionMethods.cs
  6. +12
    -0
      Svelto.ECS/Common/EntityStructs/InterpolateVector3EntityStruct.cs
  7. +4
    -0
      Svelto.ECS/Common/EntityStructs/PositionEntityStruct.cs
  8. +4
    -0
      Svelto.ECS/Common/EntityStructs/RotationEntityStruct.cs
  9. +7
    -8
      Svelto.ECS/DataStructures/TypeSafeDictionary.cs
  10. +1
    -1
      Svelto.ECS/EnginesRoot.Engines.cs
  11. +20
    -3
      Svelto.ECS/EnginesRoot.Entities.cs
  12. +25
    -0
      Svelto.ECS/EnginesRoot.GenerateEntitiesStream.cs
  13. +2
    -2
      Svelto.ECS/EnginesRoot.GenericEntityFactory.cs
  14. +15
    -0
      Svelto.ECS/EnginesRoot.GenericEntityFunctions.cs
  15. +24
    -22
      Svelto.ECS/EnginesRoot.Submission.cs
  16. +14
    -0
      Svelto.ECS/EntitiesDB.cs
  17. +1
    -1
      Svelto.ECS/EntityBuilder.cs
  18. +50
    -38
      Svelto.ECS/EntityStream.cs
  19. +14
    -18
      Svelto.ECS/EntitySubmitOperation.cs
  20. +0
    -0
      Svelto.ECS/ExclusiveGroup.cs
  21. +2
    -0
      Svelto.ECS/Extensions/Unity/GenericEntityDescriptorHolder.cs
  22. +4
    -1
      Svelto.ECS/IEntitiesDB.cs
  23. +3
    -0
      Svelto.ECS/IEntityFunctions.cs

+ 1
- 1
Svelto.Common

@@ -1 +1 @@
Subproject commit b6ff2a5f1357be35efdd86ae5ea5d1d6be4f68b8
Subproject commit 749ff282c004818f1d321a0432bba69065c412ae

+ 1
- 2
Svelto.ECS/Common/Components/ECSVector2.cs View File

@@ -2,8 +2,7 @@ namespace Svelto.ECS.Components
{
public struct ECSVector2
{
public float x;
public float y;
public float x, y;

public ECSVector2(float X, float Y)
{


+ 14
- 0
Svelto.ECS/Common/Components/ECSVector3.cs View File

@@ -0,0 +1,14 @@
namespace Svelto.ECS.Components
{
public struct ECSVector3
{
public float x, y, z;
public ECSVector3(float X, float Y, float Z)
{
x = X;
y = Y;
z = Z;
}
}
}

+ 15
- 0
Svelto.ECS/Common/Components/EcsVector4.cs View File

@@ -0,0 +1,15 @@
namespace Svelto.ECS.Components
{
public struct EcsVector4
{
public float x, y, z, w;

public EcsVector4(float X, float Y, float Z, float W)
{
x = X;
y = Y;
z = Z;
w = W;
}
}
}

+ 36
- 0
Svelto.ECS/Common/Components/ExtensionMethods.cs View File

@@ -0,0 +1,36 @@
#if UNITY_2018_3_OR_NEWER
using UnityEngine;

namespace Svelto.ECS.Components.Unity
{
namespace Svelto.ECS.Components
{
public static class ExtensionMethods
{
public static Vector3 ToVector3(ref this ECSVector3 vector) { return new Vector3(vector.x, vector.y, vector.z); }

public static void Add(ref this ECSVector3 vector1, ref ECSVector3 vector2)
{
vector1.x += vector2.x;
vector1.y += vector2.y;
vector1.z += vector2.z;
}
public static void Add(ref this ECSVector3 vector1, float x, float y, float z)
{
vector1.x += x;
vector1.y += y;
vector1.z += z;
}
public static void Interpolate(ref this ECSVector3 vector, ref ECSVector3 vectorS,
ref ECSVector3 vectorE, float time)
{
vector.x = vectorS.x * (1 - time) + vectorE.x * (time);
vector.y = vectorS.y * (1 - time) + vectorE.y * (time);
vector.z = vectorS.z * (1 - time) + vectorE.z * (time);
}
}
}
}
#endif

+ 12
- 0
Svelto.ECS/Common/EntityStructs/InterpolateVector3EntityStruct.cs View File

@@ -0,0 +1,12 @@
using Svelto.ECS.Components;

namespace Svelto.ECS.EntityStructs
{
public struct InterpolateVector3EntityStruct : IEntityStruct
{
public ECSVector3 starPos, endPos;
public float time;

public EGID ID { get; set; }
}
}

+ 4
- 0
Svelto.ECS/Common/EntityStructs/PositionEntityStruct.cs View File

@@ -1,7 +1,11 @@
using Svelto.ECS.Components;

namespace Svelto.ECS.EntityStructs
{
public struct PositionEntityStruct : IEntityStruct
{
public ECSVector3 position;

public EGID ID { get; set; }
}
}

+ 4
- 0
Svelto.ECS/Common/EntityStructs/RotationEntityStruct.cs View File

@@ -1,7 +1,11 @@
using Svelto.ECS.Components;

namespace Svelto.ECS.EntityStructs
{
public struct RotationEntityStruct : IEntityStruct
{
public EcsVector4 rotation;
public EGID ID { get; set; }
}
}

+ 7
- 8
Svelto.ECS/DataStructures/TypeSafeDictionary.cs View File

@@ -63,15 +63,14 @@ namespace Svelto.ECS.Internal
Dictionary<Type, FasterList<IHandleEntityViewEngineAbstracted>> entityViewEnginesDB,
ref PlatformProfiler profiler)
{
int count;
TValue[] values = GetValuesArray(out count);

var values = GetValuesArray(out var count);
//pay attention: even if the entity is passed by ref, it won't be saved back in the database when this
//function is called from the building of an entity. This is by design. Entity structs must be initialized
//through the EntityInitializer method and not with an Add callback.
//however the struct can be modified during an add callback if this happens as consequence of a group swap
for (int i = 0; i < count; i++)
{
TValue entity = values[i];

AddEntityViewToEngines(entityViewEnginesDB, ref entity, ref profiler);
}
AddEntityViewToEngines(entityViewEnginesDB, ref values[i], ref profiler);
}

public bool Has(int entityIdEntityId)


+ 1
- 1
Svelto.ECS/EnginesRoot.Engines.cs View File

@@ -34,7 +34,7 @@ namespace Svelto.ECS
_groupedEntityToAdd = new DoubleBufferedEntitiesToAdd<FasterDictionary<int, Dictionary<Type, ITypeSafeDictionary>>>();

_entitiesDB = new EntitiesDB(_groupEntityDB, _groupsPerEntity);
_entityStreams = new EntityStreams(_entitiesDB);
_entitiesStream = new EntitiesStream(_entitiesDB);

_scheduler = entityViewScheduler;
_scheduler.onTick = new WeakAction(SubmitEntityViews);


+ 20
- 3
Svelto.ECS/EnginesRoot.Entities.cs View File

@@ -54,9 +54,9 @@ namespace Svelto.ECS

///--------------------------------------------
///
public EntityStreams GenerateEntityStream()
public IEntitiesStream GenerateEntityStream()
{
return _entityStreams;
return new GenericEntitiesStream(new DataStructures.WeakReference<EnginesRoot>(this));
}
public IEntityFactory GenerateEntityFactory()
@@ -226,6 +226,23 @@ namespace Svelto.ECS
}
}

void RemoveGroupAndEntitiesFromDB(int groupID, Type entityDescriptor)
{
/* var profiler = new PlatformProfiler();
using (profiler.StartNewSession("Remove Group Of Entities"))
{
FasterDictionary<int, ITypeSafeDictionary> @group;
if (_groupsPerEntity.TryGetValue(entityDescriptor, out group))
{
if (group.TryGetValue())
foreach (var entity in group)
{
MoveEntity(entity.);
}
}
}*/
}

void RemoveGroupAndEntitiesFromDB(int groupID)
{
var profiler = new PlatformProfiler();
@@ -260,7 +277,7 @@ namespace Svelto.ECS
MoveEntity(builders, fromEntityID, originalEntityDescriptor, toEntityID, toGroup);
}

readonly EntityStreams _entityStreams;
readonly EntitiesStream _entitiesStream;
readonly Type _entityInfoView = typeof(EntityInfoView);
const string INVALID_DYNAMIC_DESCRIPTOR_ERROR = "Found an entity requesting an invalid dynamic descriptor, this " +


+ 25
- 0
Svelto.ECS/EnginesRoot.GenerateEntitiesStream.cs View File

@@ -0,0 +1,25 @@
namespace Svelto.ECS
{
public partial class EnginesRoot
{
class GenericEntitiesStream : IEntitiesStream
{
public GenericEntitiesStream(DataStructures.WeakReference<EnginesRoot> weakReference)
{
_weakEngine = weakReference;
}
public Consumer<T> GenerateConsumer<T>(int capacity) where T : unmanaged, IEntityStruct
{
return _weakEngine.Target._entitiesStream.GenerateConsumer<T>(capacity);
}

public void PublishEntity<T>(EGID id) where T : unmanaged, IEntityStruct
{
_weakEngine.Target._entitiesStream.PublishEntity<T>(id);
}
readonly DataStructures.WeakReference<EnginesRoot> _weakEngine;
}
}
}

+ 2
- 2
Svelto.ECS/EnginesRoot.GenericEntityFactory.cs View File

@@ -4,8 +4,6 @@
{
class GenericEntityFactory : IEntityFactory
{
readonly DataStructures.WeakReference<EnginesRoot> _weakEngine;

public GenericEntityFactory(DataStructures.WeakReference<EnginesRoot> weakReference)
{
_weakEngine = weakReference;
@@ -35,6 +33,8 @@
{
_weakEngine.Target.Preallocate<T>(groupStructId, size);
}
readonly DataStructures.WeakReference<EnginesRoot> _weakEngine;
}
}
}

+ 15
- 0
Svelto.ECS/EnginesRoot.GenericEntityFunctions.cs View File

@@ -35,6 +35,21 @@ namespace Svelto.ECS
-1, EntityDescriptorTemplate<T>.descriptor.entitiesToBuild, typeof(T)));
}

public void RemoveEntities<T>(int groupID) where T : IEntityDescriptor, new()
{
throw new NotImplementedException();
//_weakReference.Target.QueueEntitySubmitOperation(
// new EntitySubmitOperation(EntitySubmitOperationType.RemoveGroup, -1, -1, groupID, -1, null, typeof(T)));
}

public void RemoveEntities<T>(ExclusiveGroup.ExclusiveGroupStruct groupID)
where T : IEntityDescriptor, new()
{
throw new NotImplementedException();
//_weakReference.Target.QueueEntitySubmitOperation(
// new EntitySubmitOperation(EntitySubmitOperationType.RemoveGroup, -1, -1, groupID, -1, null, typeof(T)));
}

public void RemoveGroupAndEntities(int groupID)
{
_weakReference.Target.QueueEntitySubmitOperation(


+ 24
- 22
Svelto.ECS/EnginesRoot.Submission.cs View File

@@ -25,7 +25,7 @@ namespace Svelto.ECS
_transientEntitiesOperations.FastClear();
_transientEntitiesOperations.AddRange(_entitiesOperations);
_entitiesOperations.FastClear();
var entitiesOperations = _transientEntitiesOperations.ToArrayFast();
for (var i = 0; i < _transientEntitiesOperations.Count; i++)
{
@@ -39,7 +39,7 @@ namespace Svelto.ECS
new EGID(entitiesOperations[i].ID,
entitiesOperations[i].fromGroupID),
new EGID(entitiesOperations[i].toID,
entitiesOperations[i].toGroupID));
entitiesOperations[i].toGroupID));
break;
case EntitySubmitOperationType.Remove:
MoveEntity(entitiesOperations[i].builders,
@@ -48,7 +48,12 @@ namespace Svelto.ECS
entitiesOperations[i].entityDescriptor, new EGID());
break;
case EntitySubmitOperationType.RemoveGroup:
RemoveGroupAndEntitiesFromDB(entitiesOperations[i].fromGroupID);
if (entitiesOperations[i].entityDescriptor == null)
RemoveGroupAndEntitiesFromDB(entitiesOperations[i].fromGroupID);
else
RemoveGroupAndEntitiesFromDB(entitiesOperations[i].fromGroupID,
entitiesOperations[i].entityDescriptor);

break;
}
}
@@ -56,20 +61,16 @@ namespace Svelto.ECS
{
#if DEBUG && !PROFILER
var str = "Crash while executing Entity Operation"
.FastConcat(entitiesOperations[i].type.ToString())
.FastConcat(" id: ")
.FastConcat(entitiesOperations[i].ID)
.FastConcat(" to id: ")
.FastConcat(entitiesOperations[i].toID)
.FastConcat(" from groupid: ")
.FastConcat(entitiesOperations[i].fromGroupID)
.FastConcat(" to groupid: ")
.FastConcat(entitiesOperations[i].toGroupID);
.FastConcat(entitiesOperations[i].type.ToString()).FastConcat(" id: ")
.FastConcat(entitiesOperations[i].ID).FastConcat(" to id: ")
.FastConcat(entitiesOperations[i].toID).FastConcat(" from groupid: ")
.FastConcat(entitiesOperations[i].fromGroupID).FastConcat(" to groupid: ")
.FastConcat(entitiesOperations[i].toGroupID);
#if RELAXED_ECS
Console.LogException(str.FastConcat(" ", entitiesOperations[i].trace), e);
#else
#else
throw new ECSException(str.FastConcat(" ").FastConcat(entitiesOperations[i].trace), e);
#endif
#endif
#else
var str = "Entity Operation is ".FastConcat(entitiesOperations[i].type.ToString())
.FastConcat(" id: ")
@@ -87,7 +88,7 @@ namespace Svelto.ECS
}
}
}
if (_groupedEntityToAdd.current.Count > 0)
{
using (profiler.Sample("Add operations"))
@@ -112,15 +113,16 @@ namespace Svelto.ECS
finally
{
//other can be cleared now, but let's avoid deleting the dictionary every time
_groupedEntityToAdd.ClearOther();
_groupedEntityToAdd.ClearOther();
}
}
}
}
}
void AddEntityViewsToTheDBAndSuitableEngines(
FasterDictionary<int, Dictionary<Type, ITypeSafeDictionary>> groupsOfEntitiesToSubmit, PlatformProfiler profiler)

void AddEntityViewsToTheDBAndSuitableEngines(
FasterDictionary<int, Dictionary<Type, ITypeSafeDictionary>> groupsOfEntitiesToSubmit,
PlatformProfiler profiler)
{
//each group is indexed by entity view type. for each type there is a dictionary indexed by entityID
foreach (var groupOfEntitiesToSubmit in groupsOfEntitiesToSubmit)
@@ -139,10 +141,10 @@ namespace Svelto.ECS
FasterDictionary<int, ITypeSafeDictionary> groupedGroup = null;
if (groupDB.TryGetValue(entityViewTypeSafeDictionary.Key, out dbDic) == false)
dbDic = groupDB[entityViewTypeSafeDictionary.Key] = entityViewTypeSafeDictionary.Value.Create();
if (_groupsPerEntity.TryGetValue(entityViewTypeSafeDictionary.Key, out groupedGroup) == false)
groupedGroup = _groupsPerEntity[entityViewTypeSafeDictionary.Key] =
new FasterDictionary<int, ITypeSafeDictionary>();
new FasterDictionary<int, ITypeSafeDictionary>();

//Fill the DB with the entity views generate this frame.
dbDic.FillWithIndexedEntities(entityViewTypeSafeDictionary.Value);
@@ -153,7 +155,7 @@ namespace Svelto.ECS
//then submit everything in the engines, so that the DB is up to date
//with all the entity views and struct created by the entity built
foreach (var groupToSubmit in groupsOfEntitiesToSubmit)
{
{
foreach (var entityViewsPerType in groupToSubmit.Value)
{
using (profiler.Sample("Add entities to engines"))


+ 14
- 0
Svelto.ECS/EntitiesDB.cs View File

@@ -36,7 +36,21 @@ namespace Svelto.ECS.Internal
{
return QueryEntityView<T>(new EGID(id, (int) group));
}

public ref T QueryUniqueEntity<T>(int @group) where T : IEntityStruct
{
var entities = QueryEntities<T>(group, out var count);
if (count != 1) throw new ECSException("Unique entities must be unique!".FastConcat(typeof(T).ToString()));
return ref entities[0];
}
public ref T QueryUniqueEntity<T>(ExclusiveGroup.ExclusiveGroupStruct @group) where T : IEntityStruct
{
return ref QueryUniqueEntity<T>((int) @group);
}

public ref T QueryEntity<T>(EGID entityGID) where T : IEntityStruct
{
T[] array;


+ 1
- 1
Svelto.ECS/EntityBuilder.cs View File

@@ -30,7 +30,7 @@ namespace Svelto.ECS
{
DBC.ECS.Check.Require(implementors != null, "Implementors not found while building an EntityView");
DBC.ECS.Check.Require(castedDic.ContainsKey(entityID.entityID) == false,
"building an entity with already used entity id! id".FastConcat((long)entityID).FastConcat(" ", ENTITY_VIEW_NAME));
"building an entity with already used entity id! id: ".FastConcat((long)entityID).FastConcat(" ", ENTITY_VIEW_NAME));

T entityView;
EntityView<T>.BuildEntityView(entityID, out entityView);


+ 50
- 38
Svelto.ECS/EntityStream.cs View File

@@ -1,10 +1,16 @@
using System;
using System.Collections.Generic;
using Svelto.DataStructures;
using Svelto.ECS.Internal;

namespace Svelto.ECS
{
public interface IEntitiesStream
{
Consumer<T> GenerateConsumer<T>(int capacity) where T : unmanaged, IEntityStruct;
void PublishEntity<T>(EGID id) where T : unmanaged, IEntityStruct;
}

/// <summary>
/// Do not use this class in place of a normal polling.
/// I eventually realised than in ECS no form of communication other than polling entity components can exist.
@@ -16,14 +22,14 @@ namespace Svelto.ECS
/// one only
/// - you want to communicate between EnginesRoots
/// </summary>
public class EntityStreams
class EntitiesStream : IEntitiesStream
{
public EntityStreams(IEntitiesDB entitiesDb)
public EntitiesStream(IEntitiesDB entitiesDb)
{
_entitiesDB = entitiesDb;
}

public EntityStream<T>.Consumer GenerateConsumer<T>(int capacity) where T : unmanaged, IEntityStruct
public Consumer<T> GenerateConsumer<T>(int capacity) where T : unmanaged, IEntityStruct
{
if (_streams.ContainsKey(typeof(T)) == false) _streams[typeof(T)] = new EntityStream<T>();
@@ -38,56 +44,62 @@ namespace Svelto.ECS
Console.LogWarning("No Consumers are waiting for this entity to change "
.FastConcat(typeof(T).ToString()));
}
Dictionary<Type, ITypeSafeStream> _streams = new Dictionary<Type, ITypeSafeStream>();
IEntitiesDB _entitiesDB;
readonly Dictionary<Type, ITypeSafeStream> _streams = new Dictionary<Type, ITypeSafeStream>();
readonly IEntitiesDB _entitiesDB;
}

interface ITypeSafeStream
{}

public class EntityStream<T>:ITypeSafeStream where T:unmanaged, IEntityStruct
class EntityStream<T>:ITypeSafeStream where T:unmanaged, IEntityStruct
{
public class Consumer
{
public Consumer(int capacity)
{
_ringBuffer = new RingBuffer<T>(capacity);
_capacity = capacity;
}

public int Count => _ringBuffer.Count;

public void Enqueue(ref T entity)
{
if (_ringBuffer.Count >= _capacity)
throw new Exception("EntityStream capacity has been saturated");
_ringBuffer.Enqueue(ref entity);
}

readonly RingBuffer<T> _ringBuffer;
int _capacity;

public ref T Dequeue()
{
return ref _ringBuffer.Dequeue();
}
}
public void PublishEntity(ref T entity)
{
for (int i = 0; i < _buffers.Count; i++)
_buffers[i].Enqueue(ref entity);
}

public Consumer GenerateConsumer(int capacity)
public Consumer<T> GenerateConsumer(int capacity)
{
var consumer = new Consumer(capacity);
var consumer = new Consumer<T>(capacity);
_buffers.Add(consumer);
return consumer;
}

readonly FasterList<Consumer> _buffers = new FasterList<Consumer>();
readonly FasterList<Consumer<T>> _buffers = new FasterList<Consumer<T>>();
}

public class Consumer<T> where T:unmanaged, IEntityStruct
{
public Consumer(int capacity)
{
_ringBuffer = new RingBuffer<T>(capacity);
_capacity = capacity;
}

public void Enqueue(ref T entity)
{
if (_ringBuffer.Count >= _capacity)
throw new Exception("EntityStream capacity has been saturated");
_ringBuffer.Enqueue(ref entity);
}

public bool TryDequeue(ExclusiveGroup group, out T entity)
{
if (_ringBuffer.TryDequeue(out entity) == true)
return entity.ID.groupID == @group;

return false;
}
public bool TryDequeue(out T entity) { return _ringBuffer.TryDequeue(out entity); }

public void Flush() { _ringBuffer.Reset(); }
readonly RingBuffer<T> _ringBuffer;
readonly int _capacity;
}
}

+ 14
- 18
Svelto.ECS/EntitySubmitOperation.cs View File

@@ -5,35 +5,31 @@ namespace Svelto.ECS
struct EntitySubmitOperation
{
public readonly EntitySubmitOperationType type;
public readonly IEntityBuilder[] builders;
public readonly int ID;
public readonly int toID;
public readonly int toGroupID;
public readonly int fromGroupID;
public readonly Type entityDescriptor;
#if DEBUG && !PROFILER
public readonly IEntityBuilder[] builders;
public readonly int ID;
public readonly int toID;
public readonly int toGroupID;
public readonly int fromGroupID;
public readonly Type entityDescriptor;
#if DEBUG && !PROFILER
public string trace;
#endif
#endif

public EntitySubmitOperation(EntitySubmitOperationType operation,
int entityId,
int toId,
int fromGroupId,
int toGroupId,
IEntityBuilder[] builders,
Type entityDescriptor)
public EntitySubmitOperation(
EntitySubmitOperationType operation, int entityId, int toId, int fromGroupId, int toGroupId,
IEntityBuilder[] builders, Type entityDescriptor)
{
type = operation;
this.builders = builders;
ID = entityId;
toID = toId;
toGroupID = toGroupId;
fromGroupID = fromGroupId;
this.entityDescriptor = entityDescriptor;
#if DEBUG && !PROFILER
#if DEBUG && !PROFILER
trace = string.Empty;
#endif
#endif
}
}



Svelto.ECS/ExclusiveGroups.cs → Svelto.ECS/ExclusiveGroup.cs View File


+ 2
- 0
Svelto.ECS/Extensions/Unity/GenericEntityDescriptorHolder.cs View File

@@ -15,7 +15,9 @@ namespace Svelto.ECS.Unity
public string groupName => _groupName;

[SerializeField]
#pragma warning disable 649
string _groupName;
#pragma warning restore 649
}
}
#endif

+ 4
- 1
Svelto.ECS/IEntitiesDB.cs View File

@@ -15,6 +15,9 @@ namespace Svelto.ECS
bool TryQueryEntitiesAndIndex<T>(EGID entityGid, out uint index, out T[] array) where T : IEntityStruct;
bool TryQueryEntitiesAndIndex<T>(int id, ExclusiveGroup.ExclusiveGroupStruct group, out uint index, out T[] array) where T : IEntityStruct;
ref T QueryUniqueEntity<T>(ExclusiveGroup.ExclusiveGroupStruct group) where T : IEntityStruct;
ref T QueryUniqueEntity<T>(int group) where T : IEntityStruct;
ref T QueryEntity<T>(EGID entityGid) where T : IEntityStruct;
ref T QueryEntity<T>(int id, ExclusiveGroup.ExclusiveGroupStruct group) where T : IEntityStruct;
ref T QueryEntity<T>(int id, int group) where T : IEntityStruct;
@@ -90,7 +93,7 @@ namespace Svelto.ECS
bool Exists<T>(int id, int groupid) where T : IEntityStruct;
bool Exists (ExclusiveGroup.ExclusiveGroupStruct gid);
bool HasAny<T>(int group) where T:IEntityStruct;
bool HasAny<T>(int group) where T:IEntityStruct;
bool HasAny<T>(ExclusiveGroup.ExclusiveGroupStruct groupStruct) where T:IEntityStruct;
int Count<T>(ExclusiveGroup.ExclusiveGroupStruct groupStruct) where T:IEntityStruct;


+ 3
- 0
Svelto.ECS/IEntityFunctions.cs View File

@@ -8,6 +8,9 @@ namespace Svelto.ECS
void RemoveEntity<T>(int entityID, int groupID) where T : IEntityDescriptor, new();
void RemoveEntity<T>(int entityID, ExclusiveGroup.ExclusiveGroupStruct groupID) where T : IEntityDescriptor, new();
void RemoveEntity<T>(EGID entityegid) where T : IEntityDescriptor, new();
void RemoveEntities<T>(int groupID) where T : IEntityDescriptor, new();
void RemoveEntities<T>(ExclusiveGroup.ExclusiveGroupStruct groupID) where T : IEntityDescriptor, new();

void RemoveGroupAndEntities(int groupID);
void RemoveGroupAndEntities(ExclusiveGroup.ExclusiveGroupStruct groupID);


Loading…
Cancel
Save