-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenerator.cs
More file actions
53 lines (37 loc) · 869 Bytes
/
Generator.cs
File metadata and controls
53 lines (37 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Generator : MonoBehaviour
{
public int mapWidth;
public int mapHeight;
public float noiseScale;
public int octaves;
public float persistance;
public float lacunarity;
public int seed;
public Vector2 offset;
public bool autoUpdate;
public Noise.NormalizeMode normalizeMode;
public void GenerateMap ()
{
float[,] noiseMap = Noise.GenerateNoiseMap (mapWidth, mapHeight, seed, noiseScale, octaves, persistance, lacunarity, offset, normalizeMode);
MapDisplay display = FindObjectOfType<MapDisplay> ();
// display.DrawNoiseMap (noiseMap);
}
void OnValidate ()
{
if (mapWidth < 1) {
mapWidth = 1;
}
if (mapHeight < 1) {
mapHeight = 1;
}
if (lacunarity < 1) {
lacunarity = 1;
}
if (octaves < 0) {
octaves = 0;
}
}
}