コード例 #1
0
    private void GenerateCostal()
    {
        NoiseRiver.AttachMap(GenerationMap, GetCurrentBiomeTileSet().Water);
        NoiseGroundTiles.GenerateGroundTiles(GenerationMap, GetCurrentBiomeTileSet().GroundTiles);
        ForestGenerator.GenerateTreesForForest(GenerationMap);


        int coastLineSide = CoastLineGenerator.GenerateCoastline(GenerationMap, GetCurrentBiomeTileSet().Water);

        //X 0 X
        //1 X 3
        //X 2 X

        if (HasRivers)
        {
            int riverStartPoint = Mathf.FloorToInt(Width * UnityEngine.Random.Range(0.1F, 0.9F));

            switch (coastLineSide)
            {
            case 0:
                NoiseRiver.BuildRiverFromMapEdge(GenerationMap, new MapPoint(riverStartPoint, 0), GetCurrentBiomeTileSet().Water);
                break;

            case 1:
                NoiseRiver.BuildRiverFromMapEdge(GenerationMap, new MapPoint(0, riverStartPoint), GetCurrentBiomeTileSet().Water);
                break;

            case 2:
                NoiseRiver.BuildRiverFromMapEdge(GenerationMap, new MapPoint(riverStartPoint, Height), GetCurrentBiomeTileSet().Water);
                break;

            case 3:
                NoiseRiver.BuildRiverFromMapEdge(GenerationMap, new MapPoint(Width, riverStartPoint), GetCurrentBiomeTileSet().Water);
                break;

            default:
                NoiseRiver.BuildRiverFromMapEdge(GenerationMap, new MapPoint(riverStartPoint, 0), GetCurrentBiomeTileSet().Water);
                break;
            }
        }
        if (HasPaths)
        {
            GeneratePaths();
        }
    }
コード例 #2
0
    private void GeneratePlains()
    {
        NoiseGroundTiles.GenerateGroundTiles(GenerationMap, GetCurrentBiomeTileSet().GroundTiles);
        ForestGenerator.GenerateTreesForForest(GenerationMap);

        //Creating Rivers
        if (HasRivers)
        {
            int numRivers = 0;
            //numRivers = UnityEngine.Random.Range(0, 4);

            switch (Width)
            {
            case 72:
                numRivers = 1;
                break;

            case 96:
                numRivers = 1;
                break;

            case 120:
                numRivers = UnityEngine.Random.Range(1, 3);
                break;

            case 144:
                numRivers = UnityEngine.Random.Range(1, 3);
                break;

            case 200:
                numRivers = UnityEngine.Random.Range(2, 4);
                break;

            //case 255:
            //    DifferentSizeIslands.GenerateGiganticIslands(GenerationMap, tilePool.GetTileSetFromBiomeType(SelectedMapBiome)[0]);
            //    break;
            default:
                break;
            }

            int r = 0;
            while (r < numRivers)
            {
                int riverStartPoint = Mathf.FloorToInt(Width * UnityEngine.Random.Range(0.1F, 0.9F));

                int startAxis = UnityEngine.Random.Range(0, 4);

                switch (startAxis)
                {
                //X 2 X
                //1 X 3
                //X 4 X

                case 0:
                    NoiseRiver.BuildRiverFromMapEdge(GenerationMap, new MapPoint(0, riverStartPoint), GetCurrentBiomeTileSet().Water);
                    break;

                case 1:
                    NoiseRiver.BuildRiverFromMapEdge(GenerationMap, new MapPoint(riverStartPoint, Height), GetCurrentBiomeTileSet().Water);
                    break;

                case 2:
                    NoiseRiver.BuildRiverFromMapEdge(GenerationMap, new MapPoint(Width, riverStartPoint), GetCurrentBiomeTileSet().Water);
                    break;

                case 3:
                    NoiseRiver.BuildRiverFromMapEdge(GenerationMap, new MapPoint(riverStartPoint, Height), GetCurrentBiomeTileSet().Water);
                    break;

                default:
                    NoiseRiver.BuildRiverFromMapEdge(GenerationMap, new MapPoint(0, riverStartPoint), GetCurrentBiomeTileSet().Water);
                    break;
                }
                r++;
            }
        }
        if (HasPaths)
        {
            GeneratePaths();
        }
    }