Exemple #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);
        }
Exemple #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;
        }
Exemple #3
0
 public static void RemoveComponent(this ECComponent self)
 {
     self.Entity.RemoveComponent(self);
 }
Exemple #4
0
 public static void RemoveComponent(this ECComponent self, ECComponent component)
 {
     self.Entity.RemoveComponent(component);
 }
Exemple #5
0
 public static bool RemoveComponent <T>(this ECComponent self) where T : ECComponent
 {
     return(self.Entity.RemoveComponent <T>());
 }
Exemple #6
0
 public static List <T> GetComponents <T>(this ECComponent self) where T : ECComponent
 {
     return(self.Entity.GetComponents <T>());
 }
Exemple #7
0
 public static void GetComponents <T>(this ECComponent self, List <T> componentList) where T : class
 {
     self.Entity.GetComponents <T>(componentList);
 }
Exemple #8
0
 public static bool HasComponent <T>(this ECComponent self) where T : ECComponent => self.Entity.HasComponent <T>();
Exemple #9
0
 public static T AddComponent <T>(this ECComponent self) where T : ECComponent, new()
 {
     return(self.Entity.AddComponent <T>());
 }
Exemple #10
0
 public static T AddComponent <T>(this ECComponent self, T component) where T : ECComponent
 {
     return(self.Entity.AddComponent(component));
 }
Exemple #11
0
 public void Add(ECComponent component)
 {
     _componentsToAdd.Add(component);
 }