public void TestCombineLayerMasksEmpty() { var masks = new LayerMask[] { }; var combinedMask = LayerMask.GetMask(); Assert.That(masks.Combine(), Is.EqualTo(combinedMask)); }
public void TestCombineLayerMasksMultiple() { var masks = new LayerMask[] { LayerMask.GetMask("Ignore Raycast"), LayerMask.GetMask("TransparentFX"), LayerMask.GetMask("UI") }; var combinedMask = LayerMask.GetMask("Ignore Raycast", "TransparentFX", "UI"); Assert.That(masks.Combine(), Is.EqualTo(combinedMask)); }
void DoIgnore() { // does not change any instance values. output = LayerMaskExtensions.FilterMask(mask1, ignoreMask); output.SetMask("Nothing"); // another way to write it but changes outputs value. output.Combine(mask1).IgnoreFlagsInMask(ignoreMask); //if we wanted mask1 to be updated with the new mask instead, we can do something like this. mask1.IgnoreFlagsInMask(ignoreMask); }
void DoCombine() { // static CombineMasks creates a new mask from any number of existing masks. output = LayerMaskExtensions.CombineMasks(maskToCombine1, MasktoCombine2); output.SetMask("Nothing"); //or // Updates this LayerMask with any number of other layerMasks. output.Combine(maskToCombine1, MasktoCombine2); //or //if we wanted maskToCombine1 to be updated with the new mask instead, we can do something like this. maskToCombine1.Combine(MasktoCombine2); }