Mirror of Svelto.ECS because we're a fan of it
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
625B

  1. using Svelto.Common;
  2. using Svelto.ECS.Hybrid;
  3. using Svelto.ECS.Internal;
  4. namespace Svelto.ECS
  5. {
  6. static class TypeSafeDictionaryFactory<T> where T : struct, _IInternalEntityComponent
  7. {
  8. static readonly bool isUnmanaged = TypeCache<T>.isUnmanaged
  9. && typeof(IEntityViewComponent).IsAssignableFrom(typeof(T)) == false;
  10. public static ITypeSafeDictionary Create(uint size)
  11. {
  12. if (isUnmanaged)
  13. return new UnmanagedTypeSafeDictionary<T>(size);
  14. return new ManagedTypeSafeDictionary<T>(size);
  15. }
  16. }
  17. }