/// <summary> /// Constructs an entity with the given identifier. /// </summary> /// <param name="identifier"></param> public Entity(Guid identifier) { Identifier = identifier; Components = new ComponentDictionary(this); Spatial = new SpatialComponent(); Components.Add(Spatial); }
public ComponentDictionary Clone(Entity entity) { var collection = new ComponentDictionary(entity); foreach (var pair in components) { var clone = pair.Value.Clone(); Requires.That <InvalidCastException>(pair.Key.IsAssignableFrom(clone)); collection.components.Add(pair.Key, clone); } return(collection); }