Пример #1
0
 public Island(IslandSize iSize)
 {
     if (iSize == IslandSize.Null)
     {
         IslandSize = IslandSize.Null;
     }
 }
Пример #2
0
 public Island(Vector2 Size, Vector2 LBCoordinate, World W, IslandSize IsleSize)
 {
     this.Size            = Size;
     LeftBottomCoordinate = LBCoordinate;
     world      = W;
     IslandSize = IsleSize;
 }
Пример #3
0
    private void MakeNewIsland(IslandGenerator gen, int islandSeed, float[][] moistNoise, float[][] tempNoise)
    {
        System.Random islandPRNG = new System.Random(islandSeed);

        IslandSize size              = DetermineIslandSize(islandPRNG.Next());
        int        islandSize        = (int)size;
        int        x                 = islandPRNG.Next(islandSize, MaxWorldSize - islandSize);
        int        z                 = islandPRNG.Next(islandSize, MaxWorldSize - islandSize);
        Vector3    position          = new Vector3(x, 0f, z);
        int        numOfHeightLevels = islandPRNG.Next(MinNumberOfHeightLevels) + MinNumberOfHeightLevels;  // dont want island with < min height levels

        // should check to make sure islands can't overlap each other

        // copy out the relevant climate noise
        float[][] islandSpecificMoistureData = new float[islandSize][];
        float[][] islandSpecificTempData     = new float[islandSize][];
        //Debug.LogFormat("specific: {0}x{1}", islandSpecificBiomeData.Length, islandSpecificBiomeData[0].Length);
        //Debug.LogFormat("base: {0}x{1}", biomeNoise.Length, biomeNoise[0].Length);

        for (int i = 0; i < islandSize; ++i)
        {
            islandSpecificMoistureData[i] = new float[islandSize];
            islandSpecificTempData[i]     = new float[islandSize];

            for (int j = 0; j < islandSize; ++j)
            {
                //Debug.LogFormat("specific -> i: {0}, j:{1}, base -> i:{2} j:{3}",i, j, i + x, j + z);
                islandSpecificMoistureData[i][j] = moistNoise[i + x][j + z];
                islandSpecificTempData[i][j]     = tempNoise[i + x][j + z];
            }
        }


        Debug.LogFormat("new island at {0} of size {1} with {2} levels ({3})", position, size.ToString(), numOfHeightLevels, islandSeed);

        // TODO
        // create an island data class that will be returned from this function
        // should hold things like:
        // tile array, native species of plants/vegetables/etc, general climate, size, soil classification, ...

        IslandData data = gen.Generate(size, islandSeed, position, islandSpecificMoistureData, islandSpecificTempData, numOfHeightLevels);

        _islands.Add(data);
    }