示例#1
0
文件: GameData.cs 项目: wtfcolt/game
        /// <summary>
        /// Checks if an <see cref="ISpatial"/> is close enough to another <see cref="ISpatial"/> to pick it up.
        /// </summary>
        /// <param name="grabber">The <see cref="ISpatial"/> doing the picking up.</param>
        /// <param name="toGrab">The <see cref="ISpatial"/> being picked up.</param>
        /// <returns>True if the <paramref name="grabber"/> is close enough to the <paramref name="toGrab"/>
        /// to pick it up; otherwise false.</returns>
        public static bool IsValidPickupDistance(ISpatial grabber, ISpatial toGrab)
        {
            var region = GetPickupArea(grabber);

            return(toGrab.Intersects(region));
        }
示例#2
0
文件: GameData.cs 项目: wtfcolt/game
        /// <summary>
        /// Gets if the <paramref name="shopper"/> is close enough to the <paramref name="shopOwner"/> to shop.
        /// </summary>
        /// <param name="shopper">The <see cref="Entity"/> doing the shopping.</param>
        /// <param name="shopOwner">The <see cref="Entity"/> that owns the shop.</param>
        /// <returns>True if the <paramref name="shopper"/> is close enough to the <paramref name="shopOwner"/> to
        /// shop; otherwise false.</returns>
        public static bool IsValidDistanceToShop(ISpatial shopper, ISpatial shopOwner)
        {
            var area = GetValidShopArea(shopper);

            return(shopOwner.Intersects(area));
        }
示例#3
0
 /// <summary>
 /// Checks if an <see cref="ISpatial"/> is close enough to another <see cref="ISpatial"/> to pick it up.
 /// </summary>
 /// <param name="grabber">The <see cref="ISpatial"/> doing the picking up.</param>
 /// <param name="toGrab">The <see cref="ISpatial"/> being picked up.</param>
 /// <returns>True if the <paramref name="grabber"/> is close enough to the <paramref name="toGrab"/>
 /// to pick it up; otherwise false.</returns>
 public static bool IsValidPickupDistance(ISpatial grabber, ISpatial toGrab)
 {
     var region = GetPickupArea(grabber);
     return toGrab.Intersects(region);
 }
示例#4
0
 /// <summary>
 /// Gets if the <paramref name="shopper"/> is close enough to the <paramref name="shopOwner"/> to shop.
 /// </summary>
 /// <param name="shopper">The <see cref="Entity"/> doing the shopping.</param>
 /// <param name="shopOwner">The <see cref="Entity"/> that owns the shop.</param>
 /// <returns>True if the <paramref name="shopper"/> is close enough to the <paramref name="shopOwner"/> to
 /// shop; otherwise false.</returns>
 public static bool IsValidDistanceToShop(ISpatial shopper, ISpatial shopOwner)
 {
     var area = GetValidShopArea(shopper);
     return shopOwner.Intersects(area);
 }
示例#5
0
 /// <summary>
 /// Checks if the <paramref name="spatial"/> is standing on this <see cref="WallEntityBase"/>.
 /// </summary>
 /// <param name="spatial">The <see cref="ISpatial"/> to check if standing on this <see cref="WallEntityBase"/>.</param>
 /// <returns>True if the <paramref name="spatial"/> is standing on this <see cref="WallEntityBase"/>; otherwise false.</returns>
 public static bool IsEntityStandingOn(ISpatial wall, ISpatial spatial)
 {
     var rect = spatial.GetStandingAreaRect();
     return wall.Intersects(rect);
 }
示例#6
0
        /// <summary>
        /// Checks if the <paramref name="spatial"/> is standing on this <see cref="WallEntityBase"/>.
        /// </summary>
        /// <param name="spatial">The <see cref="ISpatial"/> to check if standing on this <see cref="WallEntityBase"/>.</param>
        /// <returns>True if the <paramref name="spatial"/> is standing on this <see cref="WallEntityBase"/>; otherwise false.</returns>
        public static bool IsEntityStandingOn(ISpatial wall, ISpatial spatial)
        {
            var rect = spatial.GetStandingAreaRect();

            return(wall.Intersects(rect));
        }