/** * Returns whether this Aspect would accept the given set. */ public boolean isInterested(BitVector componentBits){ // Check if the entity possesses ALL of the components defined in the aspect. if(!allSet.isEmpty() && !componentBits.containsAll(allSet)) 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; }
/** * Returns whether this Aspect would accept the given set. */ public boolean isInterested(BitVector componentBits){ // Check if the entity possesses ALL of the components defined in the aspect. if(!allSet.isEmpty() && !componentBits.containsAll(allSet)) 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; }
/** * Returns whether this Aspect would accept the given set. */ public boolean isInterested(BitVector 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; }