Advertisement
Guest User

Noise Class

a guest
Dec 22nd, 2013
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.42 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public struct Noise
  4. {
  5.     public static float[,] Generate(int xSize, int ySize, int seed, float intensity)
  6.     {
  7.         float[,] noise = new float[xSize,ySize];
  8.        
  9.         for(int x=0; x<xSize; x++)
  10.         {
  11.             for(int y=0; y<ySize; y++)
  12.             {
  13.             float xNoise = (float) x/xSize;
  14.             float yNoise = (float) y/ySize;
  15.  
  16.                 noise[x,y] = Mathf.PerlinNoise(seed+xNoise,seed+yNoise)*intensity;
  17.             }
  18.         }
  19.         return noise;
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement