Пример #1
0
        public CEntity CreateEntity(List <AComponent> componentList)
        {
            var entity = new CEntity();

            entity.InitComponents(componentList);
            return(entity);
        }
Пример #2
0
 public void OnRemoveEntity(CEntity entity)
 {
     foreach (var system in m_systems)
     {
         system.Process.MatchRemove(entity);
     }
 }
Пример #3
0
 public void OnAddEntity(CEntity entity)
 {
     foreach (var system in m_systems)
     {
         system.Process.MatchAdd(entity);
     }
 }
Пример #4
0
        public CEntity FindEntityByVaseID(uint entityBaseId)
        {
            CEntity entity = null;

            m_entityDict.TryGetValue(entityBaseId, out entity);
            return(entity);
        }
Пример #5
0
 internal void MatchSystemsRemoveComponent(CEntity entity)
 {
     for (int i = 0; i < m_phases.Count; ++i)
     {
         m_phases[i].OnRemoveEntity(entity);
     }
 }
Пример #6
0
 public void AddEntity(CEntity entity)
 {
     foreach (var phase in m_phases)
     {
         phase.OnAddEntity(entity);
     }
     m_entityDict.Add(entity.BaseId, entity);
 }
Пример #7
0
 public void RemoveEntity(CEntity entity)
 {
     foreach (var phase in m_phases)
     {
         phase.OnRemoveEntity(entity);
     }
     m_entityDict.Remove(entity.BaseId);
     entity.Destroy();
     //entity.rest() to pool
 }
Пример #8
0
 public void MatchRemove(CEntity entity)
 {
     if (EntityList.HasEntity(entity))
     {
         bool isEntityDeled = EntityList.RemoveEntity(entity);
         if (m_system != null)
         {
             m_system.UpdateRemoveEntity(entity);
         }
     }
 }
Пример #9
0
        public bool HasEntity(CEntity entity)
        {
            var p = head;

            while (p != null)
            {
                if (p.Entity == entity)
                {
                    return(true);
                }

                p = p.next;
            }
            return(false);
        }
Пример #10
0
        public bool RemoveEntity(CEntity entity)
        {
            var p = head;

            while (p != null)
            {
                if (p.Entity == entity)
                {
                    _RemoveNode(p);
                    return(true);
                }

                p = p.next;
            }
            return(false);
        }
Пример #11
0
        public void RemoveAllEntitys()
        {
            List <ulong> deleteList = new List <ulong>(m_entityDict.Keys);

            foreach (var pair in m_entityDict)
            {
                deleteList.Add(pair.Key);
            }
            for (int i = 0; i < deleteList.Count; ++i)
            {
                CEntity entity = null;
                if (m_entityDict.TryGetValue(deleteList[i], out entity))
                {
                    RemoveEntity(entity);
                }
            }
        }
Пример #12
0
        /// <summary>
        /// 尾插法添加结点
        /// </summary>
        /// <param name="node"></param>
        public void AddEntity(CEntity entity)
        {
            EntityNode node = PopNode();

            node.Entity = entity;
            node.pre    = tail;
            node.next   = null;

            if (tail != null)
            {
                tail.next = node;
            }
            tail = node;

            if (head == null)
            {
                head = node;
            }

            Count++;
        }
Пример #13
0
        public void MatchAdd(CEntity entity)
        {
            if (EntityList.HasEntity(entity))
            {
                bool isEntityDeled = EntityList.RemoveEntity(entity);
                if (entity.HasComponents(m_compoTypes))
                {
                    EntityList.AddEntity(entity);
                }
                if (m_system != null)
                {
                    m_system.UpdateRemoveEntity(entity);
                }
            }
            if (entity.HasComponents(m_compoTypes))
            {
                EntityList.AddEntity(entity);

                if (m_system != null)
                {
                    m_system.UpdateAddEntity(entity);
                }
            }
        }
Пример #14
0
 public virtual void UpdateRemoveEntity(CEntity entity)
 {
 }
Пример #15
0
 public virtual void RemoveEntity(CEntity entity)
 {
 }
Пример #16
0
 public virtual void AddEntity(CEntity entity)
 {
 }
Пример #17
0
 public void Destroy()
 {
     Entity.Destroy();
     Entity = null;
 }
Пример #18
0
 public void Dispose()
 {
     Entity = null;
 }
Пример #19
0
 public void Clear()
 {
     OnDestroy();
     IsValid  = false;
     m_entity = null;
 }
Пример #20
0
 public virtual void UpdateAddEntity(CEntity entity)
 {
 }
Пример #21
0
 public virtual void Update(CEntity entity)
 {
 }