Exemple #1
0
        public override void Removed(Entity entity)
        {
            _entities[entity.Id] = null;

            _idPool.CheckIn(entity.Id);
            base.Removed(entity);
        }
 public void RemoveComponent(Entity entity, ComponentType type)
 {
     if (entity.ComponentBits[type.Index])
     {
         _componentsByType[type.Index][entity.Id] = null;
         entity.ComponentBits[type.Index] = false;
     }
 }
        public void AddComponent(Entity entity, ComponentType componentType, IComponent component)
        {
            _componentsByType.EnsureCapacity(componentType.Index+1);
            var components = GetComponentsOfType(componentType);
            components[entity.Id] = component;

            entity.ComponentBits.Set(componentType.Index, true);
        }
 private void RemoveComponentsOfEntity(Entity entity)
 {
     var componentBits = entity.ComponentBits;
     for (var i = 0; i < componentBits.Count; i++)
     {
         if (componentBits[i])
         {
             _componentsByType[i][entity.Id] = null;
         }
     }
     componentBits.SetAll(false);
 }
 public override void Removed(Entity entity)
 {
     _deleted.Add(entity);
     base.Removed(entity);
 }
Exemple #6
0
 public override void Added(Entity entity)
 {
     _entities[entity.Id] = entity;
     base.Added(entity);
 }