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

            _idPool.CheckIn(entity.Id);
            base.Removed(entity);
        }
示例#2
0
 public void RemoveComponent(Entity entity, ComponentType type)
 {
     if (entity.ComponentBits[type.Index])
     {
         _componentsByType[type.Index][entity.Id] = null;
         entity.ComponentBits[type.Index] = false;
     }
 }
示例#3
0
        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);
        }
示例#4
0
 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);
 }
示例#5
0
 public override void Removed(Entity entity)
 {
     _deleted.Add(entity);
     base.Removed(entity);
 }
示例#6
0
 public override void Added(Entity entity)
 {
     _entities[entity.Id] = entity;
     base.Added(entity);
 }