Ejemplo n.º 1
0
 /// <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);
 }
Ejemplo n.º 2
0
        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);
        }