Beispiel #1
0
    public void DrawHubStartAndEndPoints(TileStruct[][] map, TileMap westMap, TileMap eastMap, TileMap southMap, TileMap northMap)
    {

        var NorthPoint = map[map.Length - 1][northMap.StartPointX].Clone();
        var SouthPoint = map[0][southMap.EndPointX].Clone();
        var WestPoint = map[westMap.EndPointY][0].Clone();
        var EastPoint = map[eastMap.StartPointY][map[0].Length - 1].Clone();


        DrawCorridorHorizontal(
            map,
            (map[0].Length) - TilesBeside(map, map[0].Length, eastMap.StartPointY, direction.left, TileType.Rock),
            map[0].Length,
            eastMap.StartPointY,
            TileType.Rock,
            TileType.Dirt,
            TerrainType,
            TerrainType);

        //Draw Corridor connecting map and SouthMap
        DrawCorridorHVertical(
            map,
            0,
            TilesBeside(map, southMap.EndPointX, 0, direction.up, TileType.Rock),
            southMap.EndPointX,
            TileType.Rock,
            TileType.Dirt,
            TerrainType,
            TerrainType);

        MapChecker checker = new MapChecker(map);
        EastToSouth = checker.IsPointReachable(SouthPoint, EastPoint, direction.up);


        //Draw Corridor connecting map and WestMap
        DrawCorridorHorizontal(
            map,
            0,
            TilesBeside(map, 0, westMap.EndPointY, direction.right, TileType.Rock),
            westMap.EndPointY,
            TileType.Rock,
            TileType.Dirt,
            TerrainType,
            TerrainType);

        checker = new MapChecker(map);
        SouthToWest = checker.IsPointReachable(SouthPoint, WestPoint, direction.right);


        //Draw Corridor connecting map and NorthMap
        DrawCorridorHVertical(
            map,
            (map.Length) - TilesBeside(map, northMap.StartPointX, map.Length, direction.down, TileType.Rock),
            map.Length,
            northMap.StartPointX,
            TileType.Rock,
            TileType.Dirt,
            TerrainType,
            TerrainType);
        checker = new MapChecker(map);
        WestToNorth = checker.IsPointReachable(WestPoint, NorthPoint, direction.right);
    }
Beispiel #2
0
    public TileStruct[][] createMap(ref int startX, ref int startY, ref int endX, ref int endY)
    {
        BlankMap();
        RandomFillMap();

        MakeCaverns();


        TileStruct[][] convertedArray = GetAsTileStructArr();

        PlaceBorders(TileType.Rock, convertedArray);


        TrimMap(convertedArray);
        TrimMap(convertedArray);
        TrimMap(convertedArray);

        DrawStartAndEndPoints(convertedArray, ref startX, ref startY, ref endX, ref endY);

        MapChecker checker = new MapChecker(convertedArray);


        if (checker.IsPointReachable(
            GetTileData(convertedArray, startX, startY),
            GetTileData(convertedArray, endX, endY),
            direction.right))
        {
            BreadthFirst(convertedArray, convertedArray[startY][startX]);

            Sprinkle(convertedArray, 62, DecorType.Grass);
            Sprinkle(convertedArray, 68, DecorType.Rock);


            return checker.map;
        }
        else
        {



            return createMap(ref startX, ref startY, ref endX, ref endY);
        }

    }