parent
6d912005a5
commit
6c8108e3ea
13 changed files with 73 additions and 25 deletions
@ -1,3 +0,0 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 24392c1216204b6ea64acd57bb43441b |
||||
timeCreated: 1668251924 |
||||
@ -1,3 +0,0 @@ |
||||
fileFormatVersion: 2 |
||||
guid: c9227b743e78463b8df770cefc98fb18 |
||||
timeCreated: 1668274486 |
||||
@ -1,14 +0,0 @@ |
||||
using System; |
||||
using Unity.Collections; |
||||
using Unity.Mathematics; |
||||
|
||||
namespace GameCore.TinyECS |
||||
{ |
||||
public struct EntityDataSet : IDisposable |
||||
{ |
||||
public void Dispose() |
||||
{ |
||||
//TODO |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,11 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 7b0b5bb1c56f2114ba60d9154d447872 |
||||
MonoImporter: |
||||
externalObjects: {} |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
@ -0,0 +1,11 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 747b2bec360ee8141b0b46886b09f92d |
||||
MonoImporter: |
||||
externalObjects: {} |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
@ -0,0 +1,35 @@ |
||||
using System; |
||||
using Unity.Collections; |
||||
using Unity.Mathematics; |
||||
|
||||
namespace GameCore.TinyECS |
||||
{ |
||||
public struct EntityDatabase<TEnum, TData> : IDisposable where TEnum : unmanaged where TData : unmanaged, IEntityDataStruct |
||||
{ |
||||
public TData dataStruct; |
||||
public EntityGenerator<TEnum> generator; |
||||
public EntityCollection<TEnum> collection; |
||||
|
||||
public Entity<TEnum> AddEntity() |
||||
{ |
||||
var entity = generator.Create(); |
||||
collection.Add(entity); |
||||
dataStruct.Add(); |
||||
return entity; |
||||
} |
||||
|
||||
public void RemoveEntity(Entity<TEnum> entity) |
||||
{ |
||||
generator.Delete(entity); |
||||
if (collection.Remove(entity, out var index, out var _)) |
||||
dataStruct.Remove(index); |
||||
} |
||||
|
||||
public void Dispose() |
||||
{ |
||||
generator.Dispose(); |
||||
collection.Dispose(); |
||||
dataStruct.Dispose(); |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue