Exemple #1
0
        /// <summary>
        ///     Gets a StaticTile collection representing all StaticTiles that are within 'range' of 'center' on the given 'map'
        /// </summary>
        public static List <StaticTile> GetStaticTilesInRange(this IPoint3D center, Map map, int range)
        {
            if (center == null || map == null)
            {
                return(new List <StaticTile>());
            }

            range = Math.Abs(range);

            var tiles = new List <StaticTile>((int)Math.Ceiling(Math.PI * Math.Sqrt(range)));

            ScanRange(
                center,
                map,
                range,
                r =>
            {
                if (!r.Excluded)
                {
                    tiles.AddRange(map.GetStaticTiles(r.Current));
                }

                return(false);
            },
                false);

            tiles.Free(false);

            return(tiles);
        }