using System.Collections.Generic; using System.Runtime.InteropServices; namespace MoonTools.ECS { // for saving and loading component storage public class ComponentStorageState { public int Count; public Dictionary EntityIdToStorageIndex; public byte[] EntityIDs; public byte[] Components; public static ComponentStorageState Create(int count) { return new ComponentStorageState( count, count * Marshal.SizeOf(), count * Marshal.SizeOf() ); } private ComponentStorageState(int count, int entityIDSize, int componentSize) { Count = count; EntityIdToStorageIndex = new Dictionary(count); EntityIDs = new byte[entityIDSize]; Components = new byte[componentSize]; } } }