protected virtual void RaiseOnEntityRemoved(IEntityOld entity) { if (OnEntityRemoved != null) { OnEntityRemoved(entity); } }
public void UpdateEntity(IEntityOld entity, bool isValid) { // Entity Groups if (entityGroups.Count > 0) { var enumerator = entityGroups.GetEnumerator(); while (enumerator.MoveNext()) { enumerator.Current.Value.UpdateEntity(entity, isValid && IsEntityGroupValid(entity, enumerator.Current.Key)); } enumerator.Dispose(); } // Component Groups if (componentGroups.Count > 0) { var enumerator = componentGroups.GetEnumerator(); while (enumerator.MoveNext()) { enumerator.Current.Value.UpdateEntity(entity, isValid && IsComponentGroupValid(entity, enumerator.Current.Key)); } enumerator.Dispose(); } }
void UnregisterEntity(IEntityOld entity) { if (entities.Remove(entity)) { RaiseOnEntityRemoved(entity); } }
public static bool Matches(IEntityOld entity, ByteFlag components, EntityMatchesOld match = EntityMatchesOld.All) { bool matches = false; switch (match) { case EntityMatchesOld.All: matches = MatchesAll(entity, components); break; case EntityMatchesOld.Any: matches = MatchesAny(entity, components); break; case EntityMatchesOld.None: matches = !MatchesAny(entity, components); break; case EntityMatchesOld.Exact: matches = MatchesExact(entity, components); break; } return(matches); }
void RegisterEntity(IEntityOld entity) { if (!entities.Contains(entity)) { entities.Add(entity); RaiseOnEntityAdded(entity); } }
public static void UnregisterEntity(IEntityOld entity) { masterGroup.UpdateEntity(entity, false); if (entity is IEntityUpdateable) { updateables.Remove((IEntityUpdateable)entity); } }
public static void RegisterEntity(IEntityOld entity) { InitializeManager(); masterGroup.UpdateEntity(entity, true); var updateable = entity as IEntityUpdateable; if (updateable != null) { updateables.Add(updateable); } }
static bool MatchesExact(IEntityOld entity, ByteFlag components) { for (byte i = 0; i < EntityUtility.IdCount; i++) { if (components[i] != entity.HasComponent(EntityUtility.GetComponentType(i))) { return(false); } } return(true); }
public void UpdateEntity(IEntityOld entity, bool isValid) { if (isValid) { RegisterEntity(entity); } else { UnregisterEntity(entity); } for (int i = 0; i < subGroups.Length; i++) { var subGroup = subGroups[i]; if (subGroup != null) { subGroup.UpdateEntity(entity, isValid); } } }
public static void UpdateEntity(IEntityOld entity) { masterGroup.UpdateEntity(entity, true); }
public bool IsEntityGroupValid(IEntityOld entity, ByteFlag groups) { return EntityMatchOld.Matches(entity.Groups, groups, match); }
public static bool Matches(IEntityOld entity, ByteFlag components, EntityMatchesOld match = EntityMatchesOld.All) { bool matches = false; switch (match) { case EntityMatchesOld.All: matches = MatchesAll(entity, components); break; case EntityMatchesOld.Any: matches = MatchesAny(entity, components); break; case EntityMatchesOld.None: matches = !MatchesAny(entity, components); break; case EntityMatchesOld.Exact: matches = MatchesExact(entity, components); break; } return matches; }
public bool IsComponentGroupValid(IEntityOld entity, ByteFlag components) { return(EntityMatchOld.Matches(entity, components, match)); }
public bool IsEntityGroupValid(IEntityOld entity, ByteFlag groups) { return(EntityMatchOld.Matches(entity.Groups, groups, match)); }
public void UpdateEntity(IEntityOld entity, bool isValid) { // Entity Groups if (entityGroups.Count > 0) { var enumerator = entityGroups.GetEnumerator(); while (enumerator.MoveNext()) enumerator.Current.Value.UpdateEntity(entity, isValid && IsEntityGroupValid(entity, enumerator.Current.Key)); enumerator.Dispose(); } // Component Groups if (componentGroups.Count > 0) { var enumerator = componentGroups.GetEnumerator(); while (enumerator.MoveNext()) enumerator.Current.Value.UpdateEntity(entity, isValid && IsComponentGroupValid(entity, enumerator.Current.Key)); enumerator.Dispose(); } }
static bool MatchesExact(IEntityOld entity, ByteFlag components) { for (byte i = 0; i < EntityUtility.IdCount; i++) { if (components[i] != entity.HasComponent(EntityUtility.GetComponentType(i))) return false; } return true; }
public static void SetEntity(Component component, IEntityOld entity) { entities[component] = entity; }
public bool IsComponentGroupValid(IEntityOld entity, ByteFlag components) { return EntityMatchOld.Matches(entity, components, match); }