Пример #1
0
        public void Remove(ECComponent component)
        {
            Debug.WarnIf(_componentsToRemove.Contains(component),
                         "You are trying to remove a Component ({0}) that you already removed", component);

            // this may not be a live Component so we have to watch out for if it hasnt been processed yet but it is being removed in the same frame
            if (_componentsToAdd.Contains(component))
            {
                _componentsToAdd.Remove(component);
                return;
            }

            _componentsToRemove.Add(component);
        }
Пример #2
0
        void HandleRemove(ECComponent component)
        {
            // deal with renderLayer list if necessary
            if (component is ECRenderable)
            {
                _entity.Scene.RenderableComponents.Remove(component as ECRenderable);
            }

            // deal with IUpdatable
            if (component is IUpdatable)
            {
                _updatableComponents.Remove(component as IUpdatable);
            }

            component.OnRemovedFromEntity();
            component.Entity = null;
        }
Пример #3
0
 public static void RemoveComponent(this ECComponent self)
 {
     self.Entity.RemoveComponent(self);
 }
Пример #4
0
 public static void RemoveComponent(this ECComponent self, ECComponent component)
 {
     self.Entity.RemoveComponent(component);
 }
Пример #5
0
 public static bool RemoveComponent <T>(this ECComponent self) where T : ECComponent
 {
     return(self.Entity.RemoveComponent <T>());
 }
Пример #6
0
 public static List <T> GetComponents <T>(this ECComponent self) where T : ECComponent
 {
     return(self.Entity.GetComponents <T>());
 }
Пример #7
0
 public static void GetComponents <T>(this ECComponent self, List <T> componentList) where T : class
 {
     self.Entity.GetComponents <T>(componentList);
 }
Пример #8
0
 public static bool HasComponent <T>(this ECComponent self) where T : ECComponent => self.Entity.HasComponent <T>();
Пример #9
0
 public static T AddComponent <T>(this ECComponent self) where T : ECComponent, new()
 {
     return(self.Entity.AddComponent <T>());
 }
Пример #10
0
 public static T AddComponent <T>(this ECComponent self, T component) where T : ECComponent
 {
     return(self.Entity.AddComponent(component));
 }
Пример #11
0
 public void Add(ECComponent component)
 {
     _componentsToAdd.Add(component);
 }