Пример #1
0
        public bool IsInterested(BitSet componentBits)
        {
            // Check if the entity possesses ALL of the components defined in the aspect.
            if (!allSet.IsEmpty())
            {
                for (int i = allSet.NextSetBit(0); i >= 0; i = allSet.NextSetBit(i + 1))
                {
                    if (!componentBits.Get(i))
                    {
                        return(false);
                    }
                }
            }

            // If we are STILL interested,
            // Check if the entity possesses ANY of the exclusion components, if it does then the system is not interested.
            if (!exclusionSet.IsEmpty() && exclusionSet.Intersects(componentBits))
            {
                return(false);
            }

            // If we are STILL interested,
            // Check if the entity possesses ANY of the components in the oneSet. If so, the system is interested.
            if (!oneSet.IsEmpty() && !oneSet.Intersects(componentBits))
            {
                return(false);
            }

            return(true);
        }
Пример #2
0
 public static IEnumerable <Type> GetTypesFromBits(BitSet bits)
 {
     foreach (var keyValuePair in _componentTypesMask)
     {
         if (bits.Get(keyValuePair.Value))
         {
             yield return(keyValuePair.Key);
         }
     }
 }