예제 #1
0
        public static NoiseMap2D Open(string file)
        {
            BinaryFormatter foramtter = new BinaryFormatter();
            FileStream      stream    = new FileStream(file,
                                                       FileMode.Open, FileAccess.Read, FileShare.Read);
            NoiseMap2D nm2d = new NoiseMap2D();

            nm2d.Map = (float[, ])foramtter.Deserialize(stream);
            stream.Close();
            return(nm2d);
        }
예제 #2
0
 void htaddp(Vector2Int center, int mapid)
 {
     NoiseMap2D noise = NoiseMaps[mapid];
     int radius = noise.MapSize;
     for (int z = 0; z < radius; z += 2)
     {
         for (int x = 0; x < radius; x += 2)
         {
             float gw = noise[x, z] * 0.05f;
             int wx = (z + center.x) / 2, wy = (x + center.y) / 2;
             if (XZExists(wx, wy))
                 this[wx, wy] += gw;
         }
     }
 }