mirror of
https://github.com/Xevion/Climb.git
synced 2025-12-06 01:14:35 -06:00
add simple editor for GridController
This commit is contained in:
8
Climb/Assets/Editor.meta
Normal file
8
Climb/Assets/Editor.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 70aea28051ad4379b1846c3e27a930bc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
15
Climb/Assets/Editor/GridControllerEditor.cs
Normal file
15
Climb/Assets/Editor/GridControllerEditor.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
[CustomEditor(typeof(GridController))]
|
||||
public class GridControllerEditor : UnityEditor.Editor {
|
||||
public override void OnInspectorGUI() {
|
||||
var controller = (GridController) target;
|
||||
|
||||
controller.size = EditorGUILayout.IntSlider("Size", controller.size, 1, 2048);
|
||||
controller.perlinScale = EditorGUILayout.Slider("Perlin Scale", controller.perlinScale, 0.001f, 0.5f);
|
||||
controller.offsetChange.x = EditorGUILayout.IntSlider("Horizontal Speed", (int) controller.offsetChange.x, 0, 250);
|
||||
controller.offsetChange.y = EditorGUILayout.IntSlider("Horizontal Speed", (int) controller.offsetChange.y, 0, 250);
|
||||
}
|
||||
}
|
||||
3
Climb/Assets/Editor/GridControllerEditor.cs.meta
Normal file
3
Climb/Assets/Editor/GridControllerEditor.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68c776dfa8a845ff84eb1cc937a6dbb1
|
||||
timeCreated: 1594194214
|
||||
@@ -21,9 +21,6 @@ public class GridController : MonoBehaviour {
|
||||
SetValue(x, y, Mathf.PerlinNoise((x + offset.x) * perlinScale, (y + offset.y) * perlinScale));
|
||||
}
|
||||
}
|
||||
|
||||
// Debug.Log($"{_values.Length} values regenerated.");
|
||||
// Debug.Log(String.Join(", ", _values.ToList().ConvertAll(i => i.ToString()).ToArray()));
|
||||
}
|
||||
|
||||
private void Start() {
|
||||
@@ -41,15 +38,9 @@ public class GridController : MonoBehaviour {
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
// if (Input.GetKey("space")) {
|
||||
// Debug.Log("Reloading values...");
|
||||
regenerateValues();
|
||||
// Debug.Log("Values generated. Updating Shader...");
|
||||
UpdateShader();
|
||||
// Debug.Log("Done.");
|
||||
offset += offsetChange * Time.deltaTime;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
private void OnApplicationQuit() {
|
||||
|
||||
Reference in New Issue
Block a user