public static LayerMask                 LayerMaskAll => ~0;    // all layers

        internal ProxyForceRegionResponce GetResponceTypeToOtherRegion(ProxyForceRegionDefintion other)
        {
            var coreResp = ProxyForceRegionResponce.Nothing;

            switch (regionType)
            {
            case ProxyRegionForceType.None:
                coreResp = ProxyForceRegionResponce.Nothing;
                break;

            case ProxyRegionForceType.OccupiedSpace:
                if ((other.regionType == ProxyRegionForceType.OccupiedSpace) || (other.regionType == ProxyRegionForceType.PaddingKeptEmpty))
                {
                    coreResp = ProxyForceRegionResponce.StayOutOf;
                }
                break;

            case ProxyRegionForceType.PaddingKeptEmpty:
                if (other.regionType == ProxyRegionForceType.OccupiedSpace)
                {
                    coreResp = ProxyForceRegionResponce.StayOutOf;
                }
                break;

            case ProxyRegionForceType.TowardsOccupiedSpace:
                if (other.regionType == ProxyRegionForceType.OccupiedSpace)
                {
                    coreResp = ProxyForceRegionResponce.AlignWithVolume;
                }
                break;

            case ProxyRegionForceType.TowardsOccupiedEdge:
                if (other.regionType == ProxyRegionForceType.OccupiedSpace)
                {
                    coreResp = ProxyForceRegionResponce.AlignWithEdge;
                }
                break;
            }
            if (coreResp == ProxyForceRegionResponce.Nothing)
            {
                return(ProxyForceRegionResponce.Nothing);
            }

            if (touchesAlignmentMask != MarsPlaneAlignment.None)
            {
                if (other.regionAlignment != touchesAlignmentMask)
                {
                    return(ProxyForceRegionResponce.Nothing);
                }
            }
            if ((touchesLayersMask != 0) && ((touchesLayersMask & other.regionLayer) == 0))
            {
                return(ProxyForceRegionResponce.Nothing);
            }

            return(coreResp);
        }
示例#2
0
        public void TestDefintions()
        {
            ProxyForceRegionDefintion rocc = new ProxyForceRegionDefintion()
            {
                regionType = ProxyRegionForceType.OccupiedSpace
            };
            ProxyForceRegionDefintion remp = new ProxyForceRegionDefintion()
            {
                regionType = ProxyRegionForceType.PaddingKeptEmpty
            };

            {
                AssertSame(rocc.GetResponceTypeToOtherRegion(remp), ProxyForceRegionResponce.StayOutOf);
                AssertSame(rocc.GetResponceTypeToOtherRegion(rocc), ProxyForceRegionResponce.StayOutOf);
                AssertSame(remp.GetResponceTypeToOtherRegion(remp), ProxyForceRegionResponce.Nothing);
            }
        }