public static bool IsBushDestroyable(Bush bush, GameLocation gameLocation, Point tile)
        {
            if (bush.isDestroyable(gameLocation, new Vector2(tile.X, tile.Y)))
            {
                return(true);
            }

            Type bushType = bush.GetType();

            return(bushType.Name == "DestroyableBush" || bushType.BaseType?.Name == "DestroyableBush");
        }
Beispiel #2
0
        /// <summary>
        ///     Checks whether a bush is destroyable from a given tile. Extends the game's <see
        ///     cref="Bush.isDestroyable"/> method to deal with bushes created by the Deep Woods mod.
        /// </summary>
        /// <param name="bush">The <see cref="Bush"/> instance.</param>
        /// <param name="gameLocation">The <see cref="GameLocation"/> where the bush is.</param>
        /// <param name="tileX">The tile x coordinate.</param>
        /// <param name="tileY">The tile y coordinate.</param>
        /// <returns>Returns true if the bush can be destroyed by the player, false otherwise.</returns>
        public static bool IsDestroyable(this Bush bush, GameLocation gameLocation, int tileX, int tileY)
        {
            if (bush.isDestroyable(gameLocation, new Vector2(tileX, tileY)))
            {
                return(true);
            }

            // Test for bushes from the mod Deep Woods.
            Type bushType = bush.GetType();

            return(bushType.Name == "DestroyableBush" || bushType.BaseType?.Name == "DestroyableBush");
        }