コード例 #1
0
        public IEntity CreateEntity(EntityGroups groups, bool active)
        {
            Assert.IsNotNull(groups);

            var entity = entityPool.Create();
            entity.Initialize(this, messageManager, groups, active);
            AddEntity(entity);

            return entity;
        }
コード例 #2
0
        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;
        }
コード例 #3
0
        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;
        }
コード例 #4
0
 public EntityMatch(EntityGroups groups, EntityMatches match = EntityMatches.All)
 {
     this.groups = groups;
     this.match = match;
 }
コード例 #5
0
        public EntityGroup GetGroupByEntityGroup(EntityGroups groups)
        {
            EntityGroup entityGroup;

            if (!entityGroups.TryGetValue(groups, out entityGroup))
            {
                entityGroup = CreateEntityGroup(groups);
                entityGroups[groups] = entityGroup;
            }

            return entityGroup;
        }
コード例 #6
0
 public bool IsEntityGroupValid(IEntity entity, EntityGroups groups)
 {
     return EntityMatch.Matches(entity.Groups, groups, match);
 }
コード例 #7
0
 public IEntity CreateEntity(EntityGroups groups)
 {
     return CreateEntity(groups, true);
 }