예제 #1
0
        public static bool IsMatureTreeStumpOrBoulderAt(this GameLocation gameLocation, Vector2 tile)
        {
            gameLocation.terrainFeatures.TryGetValue(tile, out TerrainFeature terrainFeature);

            int tileX = (int)tile.X;
            int tileY = (int)tile.Y;

            if (terrainFeature is Tree || terrainFeature is FruitTree ||
                (terrainFeature is Bush bush &&
                 bush.IsDestroyable(gameLocation, tileX, tileY)))
            {
                return(true);
            }

            foreach (LargeTerrainFeature largeTerrainFeature in gameLocation.largeTerrainFeatures)
            {
                if (largeTerrainFeature is Bush bush2 &&
                    bush2.getRenderBounds(new Vector2(bush2.tilePosition.X, bush2.tilePosition.Y)).Contains(
                        (int)(tile.X * Game1.tileSize),
                        (int)(tile.Y * Game1.tileSize)) && bush2.IsDestroyable(gameLocation, tileX, tileY))
                {
                    return(true);
                }
            }

            return(gameLocation.IsStumpAt(tileX, tileY) ||
                   gameLocation.IsMinableAt(tileX, tileY));
        }