fixed options, fixed save, new Screenshots, v.140
This commit is contained in:
@@ -9,7 +9,43 @@ using System.Linq;
|
||||
public class NoiseGenerator
|
||||
{
|
||||
System.Random rand = new System.Random();
|
||||
public void applyNoise(GameObject tile)
|
||||
public void applyNoise(GameObject tile, string name)
|
||||
{
|
||||
if(name.Length > 0){
|
||||
applyCityNoise(tile);
|
||||
}
|
||||
else{
|
||||
applyNormalNoise(tile);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void applyCityNoise(GameObject tile)
|
||||
{
|
||||
//resetMesh(tile);
|
||||
Mesh mesh = tile.GetComponent<MeshFilter>().mesh;
|
||||
Vector3[] vertices = mesh.vertices;
|
||||
float[] samples;
|
||||
Color32[] colors;
|
||||
int chance = rand.Next(1, 101);
|
||||
samples = calculateSamplesCity(tile);
|
||||
string tiletype = "City";
|
||||
|
||||
colors = new Color32[samples.Length];
|
||||
for (int i = 0; i < samples.Length; i++)
|
||||
{
|
||||
colors[i] = new Color32(0, 185, 0, 255);
|
||||
}
|
||||
|
||||
for (int i = 0; i < samples.Length; i++)
|
||||
{
|
||||
vertices[i].y = samples[i] * 3;
|
||||
}
|
||||
applyMesh(tile, vertices, mesh, colors);
|
||||
tile.GetComponent<Tile>().setType(tiletype);
|
||||
}
|
||||
|
||||
private void applyNormalNoise(GameObject tile)
|
||||
{
|
||||
//resetMesh(tile);
|
||||
Mesh mesh = tile.GetComponent<MeshFilter>().mesh;
|
||||
@@ -55,6 +91,7 @@ public class NoiseGenerator
|
||||
high = new Color32(0, 185, 0, 255);
|
||||
tiletype = "Plane";
|
||||
}
|
||||
|
||||
|
||||
float lowestValue = 10;
|
||||
float highestValue = 0;
|
||||
@@ -119,6 +156,17 @@ public class NoiseGenerator
|
||||
return samples;
|
||||
}
|
||||
|
||||
private float[] calculateSamplesCity(GameObject tile){
|
||||
Mesh mesh = tile.GetComponent<MeshFilter>().mesh;
|
||||
Vector3[] vertices = mesh.vertices;
|
||||
float[] samples = new float[vertices.Length];
|
||||
for (int i = 0; i < vertices.Length; i++)
|
||||
{
|
||||
samples[i] = 0;
|
||||
}
|
||||
return samples;
|
||||
}
|
||||
|
||||
private float[] calculateSamplesPlane(GameObject tile)
|
||||
{
|
||||
float[] samples = calculateBasicSamples(tile);
|
||||
|
||||
Reference in New Issue
Block a user