예제 #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);
 }