Ejemplo n.º 1
0
        public override int GetHashCode()
        {
            int hash = 13;

            hash = (hash * 7) + AllSet.GetHashCode();
            hash = (hash * 7) + OneSet.GetHashCode();
            hash = (hash * 7) + ExclusionSet.GetHashCode();

            return(hash);
        }
Ejemplo n.º 2
0
        public bool Match(IEntity entity)
        {
            Func <Type, bool> hasComponent = (t => entity.HasComponent(t));

            if (ExclusionSet.Any(hasComponent))
            {
                return(false);
            }

            if (!AllSet.All(hasComponent))
            {
                return(false);
            }

            if (OneSet.Any() && !OneSet.Any(hasComponent))
            {
                return(false);
            }

            // Nobody complained so we're good here!
            return(true);
        }