HandleEntitySilently() public method

public HandleEntitySilently ( Entity entity ) : void
entity Entity
return void
Ejemplo n.º 1
0
        /// Returns a group for the specified matcher.
        /// Calling context.GetGroup(matcher) with the same matcher will always
        /// return the same instance of the group.
        public IGroup GetGroup(IMatcher matcher)
        {
            IGroup group;

            if (!_groups.TryGetValue(matcher, out group))
            {
                group = new Group(matcher);
                var entities = GetEntities();
                for (int i = 0; i < entities.Length; i++)
                {
                    group.HandleEntitySilently(entities[i]);
                }
                _groups.Add(matcher, group);

                for (int i = 0; i < matcher.componentTypes.Length; i++)
                {
                    var componentType = matcher.componentTypes[i];
                    if (!_groupsForComponentType.ContainsKey(componentType))
                    {
                        _groupsForComponentType[componentType] = new List <IGroup>();
                    }
                    _groupsForComponentType[componentType].Add(group);
                }

                if (OnGroupCreated != null)
                {
                    OnGroupCreated(this, group);
                }
            }

            return(group);
        }
Ejemplo n.º 2
0
        /// Returns a group for the specified matcher.
        /// Calling context.GetGroup(matcher) with the same matcher will always
        /// return the same instance of the group.
        public IGroup <TEntity> GetGroup(IMatcher <TEntity> matcher)
        {
            IGroup <TEntity> group;

            if (!_groups.TryGetValue(matcher, out group))
            {
                group = new Group <TEntity>(matcher);
                var entities = GetEntities();
                for (int i = 0; i < entities.Length; i++)
                {
                    group.HandleEntitySilently(entities[i]);
                }
                _groups.Add(matcher, group);

                for (int i = 0; i < matcher.indices.Length; i++)
                {
                    var index = matcher.indices[i];
                    if (_groupsForIndex[index] == null)
                    {
                        _groupsForIndex[index] = new List <IGroup <TEntity> >();
                    }
                    _groupsForIndex[index].Add(group);
                }

                if (OnGroupCreated != null)
                {
                    OnGroupCreated(this, group);
                }
            }

            return(group);
        }
Ejemplo n.º 3
0
        public virtual Group GetGroup(IMatcher matcher)
        {
            Group group;

            if (!_groups.TryGetValue(matcher, out group))
            {
                group = new Group(matcher);
                var entities = GetEntities();
                for (int i = 0, entitiesLength = entities.Length; i < entitiesLength; i++)
                {
                    group.HandleEntitySilently(entities[i]);
                }
                _groups.Add(matcher, group);

                for (int i = 0, indicesLength = matcher.indices.Length; i < indicesLength; i++)
                {
                    var index = matcher.indices[i];
                    if (_groupsForIndex[index] == null)
                    {
                        _groupsForIndex[index] = new List <Group>();
                    }
                    _groupsForIndex[index].Add(group);
                }

                if (OnGroupCreated != null)
                {
                    OnGroupCreated(this, group);
                }
            }

            return(group);
        }
Ejemplo n.º 4
0
        public virtual Group GetGroup(IMatcher matcher)
        {
            Group group;
            if (!_groups.TryGetValue(matcher, out group)) {
                group = new Group(matcher);
                var entities = GetEntities();
                for (int i = 0, entitiesLength = entities.Length; i < entitiesLength; i++) {
                    group.HandleEntitySilently(entities[i]);
                }
                _groups.Add(matcher, group);

                for (int i = 0, indicesLength = matcher.indices.Length; i < indicesLength; i++) {
                    var index = matcher.indices[i];
                    if (_groupsForIndex[index] == null) {
                        _groupsForIndex[index] = new List<Group>();
                    }
                    _groupsForIndex[index].Add(group);
                }

                if (OnGroupCreated != null) {
                    OnGroupCreated(this, group);
                }
            }

            return group;
        }