get() public method

Returns a new BitSet composed of a range of bits from this one.
public get ( int from, int to ) : BitSet
from int the low index (inclusive)
to int the high index (exclusive)
return BitSet
Example #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);
        }
Example #2
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;
		}
Example #3
0
		public static IEnumerable<Type> getTypesFromBits( BitSet bits )
		{
			foreach( var keyValuePair in _componentTypesMask )
			{
				if( bits.get( keyValuePair.Value ) )
					yield return keyValuePair.Key;
			}   
		}
 public static IEnumerable <Type> getTypesFromBits(BitSet bits)
 {
     foreach (var keyValuePair in _componentTypesMask)
     {
         if (bits.get(keyValuePair.Value))
         {
             yield return(keyValuePair.Key);
         }
     }
 }