public override void OnInspectorGUI() { //string[] strings =new [] { "foo", "foobar" }; //EditorGUILayout.Popup(0, strings); if (GUILayout.Button("Bake", GUILayout.Height(40))) { _grid.Bake(); } _grid = (qpGrid)target; _grid.DrawInEditor = (GUILayout.Toggle(_grid.DrawInEditor, "Draw In Editor")); GUIStyle style = new GUIStyle(); style.fixedWidth = 200; style.contentOffset = new Vector2(300, 0); _grid.startCoordinate = EditorGUILayout.Vector2Field("Start point of Grid", _grid.startCoordinate); _grid.endCoordinate = EditorGUILayout.Vector2Field("End point of Grid", _grid.endCoordinate); GUILayout.Label("Up Direction"); _grid.UpDirection = (qpGrid.Axis)EditorGUILayout.EnumPopup(_grid.UpDirection); _showHighestPoint(); _showLowestPoint(); _showNodeSpread(); _showDisallowedTags(); _showIgnoreTags(); if (GUI.changed) { EditorUtility.SetDirty(target); } }
private void _createPuzzle() { text.text = ""; _puzzleGrid = new GameObject[10, 10]; _makeWallRow(1); _makeWallRow(3); _makeWallRow(5); _makeWallRow(7); grid.Bake(); player.FindClosestNode(); Vector2 vec = new Vector3(UnityEngine.Random.Range(0, 8.5f), _collectableRow); _collectableRow = (_collectableRow == 0 ? 8.5f : 0); _makeCollectableAt(vec); int[] ys = new int[] { 2, 4, 6 }; for (int i = _completed; i > 0; i--) { int x = UnityEngine.Random.Range(0, 10); int y = ys[UnityEngine.Random.Range(0, ys.Length)]; _makeCollectableAt(new Vector2(x, y)); } _rebuilding = false; }
public override void OnInspectorGUI() { //string[] strings =new [] { "foo", "foobar" }; //EditorGUILayout.Popup(0, strings); if (GUILayout.Button("Bake", GUILayout.Height(40))) { _grid.Bake(); } _grid = (qpGrid)target; _grid.DrawInEditor = (GUILayout.Toggle(_grid.DrawInEditor, "Draw In Editor")); GUIStyle style = new GUIStyle(); style.fixedWidth = 200; style.contentOffset = new Vector2(300, 0); _grid.startCoordinate = EditorGUILayout.Vector2Field("Start point of Grid", _grid.startCoordinate); _grid.endCoordinate = EditorGUILayout.Vector2Field("End point of Grid", _grid.endCoordinate); GUILayout.Label("Up Direction"); _grid.UpDirection = (qpGrid.Axis)EditorGUILayout.EnumPopup(_grid.UpDirection); _grid.UpRaycastStart = EditorGUILayout.FloatField("Highest Point", _grid.UpRaycastStart); _grid.UpRayCastEnd = EditorGUILayout.FloatField("Lowest Point", _grid.UpRayCastEnd); _grid.spread = EditorGUILayout.FloatField("Node Spread", _grid.spread); _grid.MaxNodeDistance = EditorGUILayout.FloatField("Max Node Connection Distance", _grid.MaxNodeDistance); _grid.NodeConnectionDepth = EditorGUILayout.IntField("Node Connection Depth", _grid.NodeConnectionDepth); _grid.RaycastBetweenNodes = (GUILayout.Toggle(_grid.RaycastBetweenNodes, "Raycast between nodes before connecting them")); _showDisallowedTags(); _showIgnoreTags(); if (GUI.changed) { EditorUtility.SetDirty(target); } }