private void EvaluateStat() { if (targetStat == null) { return; } if (statBlock == null) { ConditionalGraph condGraph = graph as ConditionalGraph; if (condGraph.GetStateMachineOwner() == null) { return; } statBlock = condGraph.GetStateMachineOwner().GetComponent <StatBlock>(); if (statBlock == null) { return; } } Stat retreivedStat = null; if (statBlock.TryGetValue(targetStat, out retreivedStat)) { currentValue = retreivedStat.value; outputValue = retreivedStat.value; statValue = retreivedStat; } }
private void EvaulateGraphCached(ConditionalGraph graph) { if (evaluationCounter++ >= evaluateEveryNFrames) { lastCachedEvaluation = graph.EvaluateGraph(); evaluationCounter = 0; } }
/// <summary> /// Removes our condition graph automatically if we delete the root node. /// </summary> public void DeleteIfNoRootNode() { ConditionalGraph cur = this.target as ConditionalGraph; if (cur.rootNode == null) { cur.Clear(); AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(cur)); } }
public override void OnBodyGUI() { base.OnBodyGUI(); ConditionalRootNode node = target as ConditionalRootNode; ConditionalGraph condGraph = node.graph as ConditionalGraph; if (GUILayout.Button("Back To State Graph")) { StateMachineGraph fsmgraph = condGraph.parentNode.graph as StateMachineGraph; NodeEditorWindow.Open(fsmgraph); } }
public override void OnHeaderGUI() { GUI.color = Color.white; ConditionalRootNode node = target as ConditionalRootNode; ConditionalGraph graph = node.graph as ConditionalGraph; EvaulateGraphCached(graph); if (lastCachedEvaluation) { GUI.color = Color.green; } else { GUI.color = Color.red; } string title = target.name; GUILayout.Label(title, NodeEditorResources.styles.nodeHeader, GUILayout.Height(30)); GUI.color = Color.white; }