public IEntity CreateEntity(EntityGroups groups, bool active) { Assert.IsNotNull(groups); var entity = entityPool.Create(); entity.Initialize(this, messageManager, groups, active); AddEntity(entity); return entity; }
public EntityGroup CreateEntityGroup(EntityGroups groups) { var entityGroup = new EntityGroup(); for (int i = 0; i < parent.Count; i++) { var entity = parent[i]; entityGroup.UpdateEntity(entity, IsEntityGroupValid(entity, groups)); } return entityGroup; }
public static bool Matches(EntityGroups groups1, EntityGroups groups2, EntityMatches match = EntityMatches.All) { bool matches = false; switch (match) { case EntityMatches.All: matches = groups1.HasAll(groups2); break; case EntityMatches.Any: matches = groups1.HasAny(groups2); break; case EntityMatches.None: matches = groups1.HasNone(groups2); break; case EntityMatches.Exact: matches = groups1 == groups2; break; } return matches; }
public EntityMatch(EntityGroups groups, EntityMatches match = EntityMatches.All) { this.groups = groups; this.match = match; }
public EntityGroup GetGroupByEntityGroup(EntityGroups groups) { EntityGroup entityGroup; if (!entityGroups.TryGetValue(groups, out entityGroup)) { entityGroup = CreateEntityGroup(groups); entityGroups[groups] = entityGroup; } return entityGroup; }
public bool IsEntityGroupValid(IEntity entity, EntityGroups groups) { return EntityMatch.Matches(entity.Groups, groups, match); }
public IEntity CreateEntity(EntityGroups groups) { return CreateEntity(groups, true); }