public CEntity CreateEntity(List <AComponent> componentList) { var entity = new CEntity(); entity.InitComponents(componentList); return(entity); }
public void OnRemoveEntity(CEntity entity) { foreach (var system in m_systems) { system.Process.MatchRemove(entity); } }
public void OnAddEntity(CEntity entity) { foreach (var system in m_systems) { system.Process.MatchAdd(entity); } }
public CEntity FindEntityByVaseID(uint entityBaseId) { CEntity entity = null; m_entityDict.TryGetValue(entityBaseId, out entity); return(entity); }
internal void MatchSystemsRemoveComponent(CEntity entity) { for (int i = 0; i < m_phases.Count; ++i) { m_phases[i].OnRemoveEntity(entity); } }
public void AddEntity(CEntity entity) { foreach (var phase in m_phases) { phase.OnAddEntity(entity); } m_entityDict.Add(entity.BaseId, entity); }
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 }
public void MatchRemove(CEntity entity) { if (EntityList.HasEntity(entity)) { bool isEntityDeled = EntityList.RemoveEntity(entity); if (m_system != null) { m_system.UpdateRemoveEntity(entity); } } }
public bool HasEntity(CEntity entity) { var p = head; while (p != null) { if (p.Entity == entity) { return(true); } p = p.next; } return(false); }
public bool RemoveEntity(CEntity entity) { var p = head; while (p != null) { if (p.Entity == entity) { _RemoveNode(p); return(true); } p = p.next; } return(false); }
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); } } }
/// <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++; }
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); } } }
public virtual void UpdateRemoveEntity(CEntity entity) { }
public virtual void RemoveEntity(CEntity entity) { }
public virtual void AddEntity(CEntity entity) { }
public void Destroy() { Entity.Destroy(); Entity = null; }
public void Dispose() { Entity = null; }
public void Clear() { OnDestroy(); IsValid = false; m_entity = null; }
public virtual void UpdateAddEntity(CEntity entity) { }
public virtual void Update(CEntity entity) { }