Exemplo n.º 1
0
        public List <HotelTilePoint> Find(int xCurrent, int yCurrent, int count, int xSize, int ySize, int xTileSize, int yTileSize, Dictionary <int, List <HotelTilePoint> > data)
        {
            List <HotelTilePoint> result = new List <HotelTilePoint>();

            TileIdClaculator tileIdGenerator = new TileIdClaculator();

            int tileId = tileIdGenerator.GenerateTileId(xSize, ySize, xTileSize, yTileSize, xCurrent, yCurrent);

            result.AddRange(data[tileId]);

            foreach (int nearId in tileIdGenerator.findNears(tileId, xSize, ySize, xTileSize, yTileSize))
            {
                result.AddRange(data[nearId]);
            }

            result = result.Take(count).ToList();

            return(result);
        }
        public List <HotelTilePoint> GenerateSpaceSec(int xSize, int ySize, int xTileSize, int yTileSize, int hc)
        {
            List <HotelTilePoint> result = new List <HotelTilePoint>();

            TileIdClaculator tileIdGenerator = new TileIdClaculator();

            int addCount = 0;

            while (addCount < hc)
            {
                int x = rnd.Next(0, xSize);
                int y = rnd.Next(0, ySize);
                if (!result.Any(item => item.X == x && item.Y == y))
                {
                    result.Add(new HotelTilePoint(x, y, tileIdGenerator.GenerateTileId(xSize, ySize, xTileSize, yTileSize, x, y)));
                    addCount++;
                }
            }

            return(result);
        }