Ejemplo n.º 1
0
        public CEntity CreateEntity(List <AComponent> componentList)
        {
            var entity = new CEntity();

            entity.InitComponents(componentList);
            return(entity);
        }
Ejemplo n.º 2
0
 public void OnRemoveEntity(CEntity entity)
 {
     foreach (var system in m_systems)
     {
         system.Process.MatchRemove(entity);
     }
 }
Ejemplo n.º 3
0
 public void OnAddEntity(CEntity entity)
 {
     foreach (var system in m_systems)
     {
         system.Process.MatchAdd(entity);
     }
 }
Ejemplo n.º 4
0
        public CEntity FindEntityByVaseID(uint entityBaseId)
        {
            CEntity entity = null;

            m_entityDict.TryGetValue(entityBaseId, out entity);
            return(entity);
        }
Ejemplo n.º 5
0
 internal void MatchSystemsRemoveComponent(CEntity entity)
 {
     for (int i = 0; i < m_phases.Count; ++i)
     {
         m_phases[i].OnRemoveEntity(entity);
     }
 }
Ejemplo n.º 6
0
 public void AddEntity(CEntity entity)
 {
     foreach (var phase in m_phases)
     {
         phase.OnAddEntity(entity);
     }
     m_entityDict.Add(entity.BaseId, entity);
 }
Ejemplo n.º 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
 }
Ejemplo n.º 8
0
 public void MatchRemove(CEntity entity)
 {
     if (EntityList.HasEntity(entity))
     {
         bool isEntityDeled = EntityList.RemoveEntity(entity);
         if (m_system != null)
         {
             m_system.UpdateRemoveEntity(entity);
         }
     }
 }
Ejemplo n.º 9
0
        public bool HasEntity(CEntity entity)
        {
            var p = head;

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

                p = p.next;
            }
            return(false);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 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++;
        }
Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 14
0
 public virtual void UpdateRemoveEntity(CEntity entity)
 {
 }
Ejemplo n.º 15
0
 public virtual void RemoveEntity(CEntity entity)
 {
 }
Ejemplo n.º 16
0
 public virtual void AddEntity(CEntity entity)
 {
 }
Ejemplo n.º 17
0
 public void Destroy()
 {
     Entity.Destroy();
     Entity = null;
 }
Ejemplo n.º 18
0
 public void Dispose()
 {
     Entity = null;
 }
Ejemplo n.º 19
0
 public void Clear()
 {
     OnDestroy();
     IsValid  = false;
     m_entity = null;
 }
Ejemplo n.º 20
0
 public virtual void UpdateAddEntity(CEntity entity)
 {
 }
Ejemplo n.º 21
0
 public virtual void Update(CEntity entity)
 {
 }