Exemplo n.º 1
0
        /// <summary>
        /// 判断另一个边界是否与此有重叠
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public bool IsIntersectWith(FixedBounds2D other)
        {
            bool pivotIn       = IsPointInBounds(other.pivot);
            bool diagonalIn    = IsPointInBounds(other.Diagonal);
            bool bottomRightIn = IsPointInBounds(other.BottomRight);
            bool upLeftlIn     = IsPointInBounds(other.UpLeft);

            if ((bottomRightIn || upLeftlIn || pivotIn || diagonalIn))
            {
                return(true);
            }
            if (!bottomRightIn && !upLeftlIn && !pivotIn && !diagonalIn)
            {
                pivotIn       = other.IsPointInBounds(pivot);
                diagonalIn    = other.IsPointInBounds(Diagonal);
                bottomRightIn = other.IsPointInBounds(BottomRight);
                upLeftlIn     = other.IsPointInBounds(UpLeft);
                if ((bottomRightIn || upLeftlIn || pivotIn || diagonalIn))
                {
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 判断点是否在房间内
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="z"></param>
 /// <returns></returns>
 public bool IsPointIn(int x, int y, int z)
 {
     return(bounds.IsPointInBounds(new VectorInt(x, y, z)));
 }