public void CopyFrom(EcsComponentMask mask) { BitsCount = mask.BitsCount; if (Bits.Length < BitsCount) { Bits = new int[mask.Bits.Length]; } Array.Copy(mask.Bits, 0, Bits, 0, BitsCount); }
public bool IsIntersects(EcsComponentMask mask) { if (BitsCount > 0 && mask.BitsCount > 0) { for (var i = 0; i < BitsCount; i++) { var bit = Bits[i]; for (var j = 0; j < mask.BitsCount; j++) { if (mask.Bits[j] == bit) { return(true); } } } } return(false); }
public bool IsEquals(EcsComponentMask mask) { if (BitsCount != mask.BitsCount) { return(false); } for (var i = 0; i < BitsCount; i++) { var j = mask.BitsCount - 1; var bit = Bits[i]; for (; j >= 0; j--) { if (mask.Bits[j] == bit) { break; } } if (j == -1) { return(false); } } return(true); }