public GroupObserver(Group[] groups, GroupEventType[] eventTypes) {
            if (groups.Length != eventTypes.Length) {
                throw new GroupObserverException("Unbalanced count with groups (" + groups.Length +
                    ") and event types (" + eventTypes.Length + ")");
            }

            _collectedEntities = new HashSet<Entity>(EntityEqualityComparer.comparer);
            _groups = groups;
            _eventTypes = eventTypes;
            _addEntityCache = addEntity;
            Activate();
        }
        public GroupObserver(Group[] groups, GroupEventType[] eventTypes)
        {
            if (groups.Length != eventTypes.Length)
            {
                throw new GroupObserverException("Unbalanced count with groups (" + groups.Length +
                                                 ") and event types (" + eventTypes.Length + ")");
            }

            _collectedEntities = new HashSet <Entity>(EntityEqualityComparer.comparer);
            _groups            = groups;
            _eventTypes        = eventTypes;
            _addEntityCache    = addEntity;
            Activate();
        }
        /// Creates an EntityCollector and will collect changed entities based on the specified eventTypes.
        public EntityCollector(Group[] groups, GroupEventType[] eventTypes)
        {
            _groups            = groups;
            _collectedEntities = new HashSet <Entity>(EntityEqualityComparer.comparer);
            _eventTypes        = eventTypes;

            if (groups.Length != eventTypes.Length)
            {
                throw new EntityCollectorException("Unbalanced count with groups (" + groups.Length +
                                                   ") and event types (" + eventTypes.Length + ").",
                                                   "Group and event type count must be equal.");
            }

            _addEntityCache = addEntity;
            Activate();
        }
Exemple #4
0
        /// Creates an Collector and will collect changed entities
        /// based on the specified groupEvents.
        public Collector(Group[] groups, GroupEvent[] groupEvents)
        {
            _groups = groups;
            _collectedEntities = new HashSet<Entity>(
                EntityEqualityComparer.comparer
            );
            _groupEvents = groupEvents;

            if(groups.Length != groupEvents.Length) {
                throw new CollectorException(
                    "Unbalanced count with groups (" + groups.Length +
                    ") and group events (" + groupEvents.Length + ").",
                    "Group and group events count must be equal."
                );
            }

            _addEntityCache = addEntity;
            Activate();
        }