Exemple #1
0
        public void TestCombineLayerMasksEmpty()
        {
            var masks        = new LayerMask[] { };
            var combinedMask = LayerMask.GetMask();

            Assert.That(masks.Combine(), Is.EqualTo(combinedMask));
        }
Exemple #2
0
        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));
        }
Exemple #3
0
    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);
    }
Exemple #4
0
    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);
    }