From fdc114e7db83184ae941cc9626e31c84bea0e549 Mon Sep 17 00:00:00 2001 From: Pixeye Date: Thu, 30 Apr 2020 10:31:36 +0200 Subject: [PATCH] Update --- Runtime/LibEcs/CacheEntity.cs | 19 +------------------ Runtime/LibEcs/Entity.cs | 6 +++++- package.json | 2 +- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/Runtime/LibEcs/CacheEntity.cs b/Runtime/LibEcs/CacheEntity.cs index f54ffd6f..5ca4a66c 100644 --- a/Runtime/LibEcs/CacheEntity.cs +++ b/Runtime/LibEcs/CacheEntity.cs @@ -57,23 +57,6 @@ public void CleanMask(int id) Entity.GenerationsInstant[id, generation] &= ~mask; } } - - // public void Remove(int type) - // { - // var typeConverted = (ushort) type; - // - // for (int i = componentsAmount - 1; i >= 0; i--) - // { - // if (componentsIds[i] == typeConverted) - // { - // for (int j = i; j < componentsAmount; ++j) - // componentsIds[j] = componentsIds[j + 1]; - // - // componentsAmount--; - // - // break; - // } - // } - // } + } } \ No newline at end of file diff --git a/Runtime/LibEcs/Entity.cs b/Runtime/LibEcs/Entity.cs index 45a7cbb7..57b4f989 100644 --- a/Runtime/LibEcs/Entity.cs +++ b/Runtime/LibEcs/Entity.cs @@ -220,9 +220,13 @@ public static ref T Set(in this ent entity) public static void Set(in this ent entity, T component) { var id = entity.id; + + if (id >= Storage.components.Length) + Array.Resize(ref Storage.components, id << 1); + entities[id].Add(Storage.componentId); GenerationsInstant[id, Storage.Generation] |= Storage.ComponentMask; - + ref var componentInStorage = ref Storage.components[id]; componentInStorage = component; } diff --git a/package.json b/package.json index df3bdc19..e43e9fae 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "displayName": "Actors", "description": "ACTORS is a complete game framework with multiscene editing, game object pooling, ECS and data-driven approach for game logic explicitly built for Unity3d. It is used to ease the pain of decoupling data from behaviors without tons of boilerplate code and unnecessary overhead.", "unity": "2019.3", - "version": "2020.4.16", + "version": "2020.4.30", "keywords": [ "ecs", "pixeye",