public override void OnHeaderGUI() { // Change header title color if main model if (_pcgModelNode == null) { _pcgModelNode = (PCGModelNode)target; } GUIStyle current = _pcgModelNode.isMain ? _mainModelStyle : NodeEditorResources.styles.nodeHeader; GUILayout.Label(target.name, current, GUILayout.Height(30)); }
public void MarkModelAsMain(PCGModelNode n) { if (_currentGraph != null) { if (_currentGraph.mainModel != null) { _currentGraph.mainModel.isMain = false; } _currentGraph.mainModel = n; _currentGraph.mainModel.isMain = true; } }
public override void OnBodyGUI() { if (_pcgModelNode == null) { _pcgModelNode = (PCGModelNode)target; } // Specifying the update method onUpdateNode = NodeUpdate; serializedObject.Update(); NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("allTileset")); NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("width")); NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("height")); serializedObject.ApplyModifiedProperties(); }
private void Generate(PCGModelNode model, string graphName) { if (_generateSeed && !_sameSeedAllGraph) { _seed = (int)DateTime.Now.Ticks; } Vector3Int offset = _grid.WorldToCell(transform.position); GameObject go = Instantiate(_tilemapTemplates[_tilemapType], transform); go.name = graphName; Tilemap tilemap = go.GetComponent <Tilemap>(); TilemapRenderer tilemapRenderer = go.GetComponent <TilemapRenderer>(); _tilemaps.Add(tilemap); // Call the generate method of the main model node foreach (TileCaseStruct tcs in model.Generate(_seed)) { tilemap.SetTile(tcs.position + offset, tcs.tile); } }