protected Subsystem(World theWorld) { World = theWorld; World.EntityManager.RegisterSubsystem(this); ComponentMask = new BitSet(); RelevantEntities = new List<uint> (); _entitiesToAdd = new List<uint>(); _entitiesToRemove = new List<uint>(); }
/// <summary> /// Determines whether all of the bits in this instance are also set in the given bitset. /// </summary> /// <param name="other">The bitset to check.</param> /// <returns><c>true</c> if all of the bits in this instance are set in <paramref name="other"/>; otherwise, <c>false</c>.</returns> public bool IsSubsetOf(BitSet other) { if (other == null) throw new ArgumentNullException("other"); var otherBits = other.bits; int count = Math.Min(bits.Length, otherBits.Length); for (int i = 0; i < count; i++) { uint bit = bits[i]; if ((bit & otherBits[i]) != bit) return false; } // handle extra bits on our side that might just be all zero int extra = bits.Length - count; for (int i = count; i < extra; i++) { if (bits[i] != 0) return false; } return true; }