public EntityArchetype RemoveShared <T> () where T : class, ISharedComponent { EntityArchetype archetype = this.Clone() as EntityArchetype; archetype.sharedComponents.Remove(typeof(T)); archetype.CalculateHashAndMask(); return(archetype); }
public EntityArchetype Remove <T> () where T : unmanaged, IComponent { EntityArchetype archetype = this.Clone() as EntityArchetype; archetype.components.Remove(typeof(T)); archetype.CalculateHashAndMask(); return(archetype); }
public EntityArchetype AddShared <T>(T component) where T : class, ISharedComponent { EntityArchetype archetype = this.Clone() as EntityArchetype; archetype.sharedComponents[typeof(T)] = component; archetype.CalculateHashAndMask(); return(archetype); }
public EntityArchetype Add <T>() where T : unmanaged, IComponent { EntityArchetype archetype = this.Clone() as EntityArchetype; archetype.components.Add(typeof(T), Unsafe.SizeOf <T>()); archetype.CalculateHashAndMask(); return(archetype); }
private EntityArchetype Clone() { EntityArchetype archetype = new EntityArchetype(); archetype.components = new Dictionary <System.Type, int>(components); archetype.sharedComponents = new Dictionary <Type, ISharedComponent>(sharedComponents); archetype.CalculateHashAndMask(); return(archetype); }