HandleEntity() public method

public HandleEntity ( Entity entity, int index, IComponent component ) : void
entity Entity
index int
component IComponent
return void
Exemplo n.º 1
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.HandleEntity(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);
        }
Exemplo n.º 2
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.HandleEntity(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;
        }