private void DrawGraph(RuntimeStateGraph graph) { DrawConnections(graph); DrawNodes(graph); GUI.EndScrollView(); ProcessEvents(Event.current); var sideRect = new Rect(position.width - Border, 0, Border - 10, position.height); _scrollPosition1 = GUI.BeginScrollView(sideRect, _scrollPosition1, new Rect(0, 0, Border, MaxRectSize)); EditorGUILayout.LabelField("IsActive " + graph.IsActive); EditorGUILayout.LabelField("Current " + graph.Current != null ? graph.Current.Node.name : "null"); EditorGUILayout.LabelField(" "); EditorGUILayout.LabelField("-Variables-"); foreach (var valueVariable in graph.Variables) { EditorGUILayout.LabelField(valueVariable.Key + ": "); EditorGUILayout.LabelField(valueVariable.Value.ToString()); } EditorGUILayout.LabelField(" "); EditorGUILayout.LabelField("-Triggers-"); foreach (string trigger in graph.TriggerLog.InOrder()) { EditorGUILayout.LabelField(graph.TriggerLog.GetTime(trigger).ToString("F3") + ": "); EditorGUILayout.LabelField(trigger); } GUI.EndScrollView(); Repaint(); }
private void DrawConnections(RuntimeStateGraph graph) { for (int i = 0; i < graph.OriginalGraph.Count; i++) { var node = graph.OriginalGraph[i]; for (int c = 0; c < node.OutPoints.Count; c++) { var connectOut = node.OutPoints[c]; if (connectOut.Target == null) { continue; } var connectIn = connectOut.Target.GetConnectionInPointById(connectOut.TargetId); Handles.DrawBezier( connectIn.Rect.center, connectOut.Rect.center, connectIn.Rect.center + Vector2.left * 50f, connectOut.Rect.center - Vector2.left * 50f, Color.white, null, 2f ); } } }
public RuntimeNode(EventNode node, RuntimeStateGraph graph) : base(node, graph) { _originalNode = node; if (_originalNode.Loop) { _loopCondition = _originalNode.LoopCondition.GetRuntime(); } }
public RuntimeStateGraph(RuntimeStateGraph parent, StateGraph graph, Entity entity) { GlobalTriggers = parent.GlobalTriggers; Variables = parent.Variables; OriginalGraph = graph; ParentGraph = parent; Entity = entity; SetupGraph(); }
public RuntimeNode(SwitchExternalNode node, RuntimeStateGraph graph) : base(node, graph) { _originalNode = node; _externalGraphs = new RuntimeStateGraph[node.Graphs.Length]; for (int i = 0; i < _externalGraphs.Length; i++) { _externalGraphs[i] = node.Graphs[i].GetRuntimeGraph(graph, graph.Entity); _externalGraphs[i].OnComplete += ExternalGraphCompleted; } }
public override RuntimeStateNode GetRuntimeNode(RuntimeStateGraph graph) { if (InstancedIndex >= 0) { return(new InstancedRuntimeAnimationNode(this, graph)); } if (Animation.IsDirectional) { return(new DirectionalRuntimeAnimationNode(this, graph)); } return(new RuntimeSpriteAnimationNode(this, graph)); }
public RuntimeNode(SetSpriteNode node, RuntimeStateGraph graph) : base(node, graph) { _spriteNode = node; if (_spriteNode.InstancedIndex >= 0) { _simpleRenderer = Graph.Entity.Get <SpriteSimpleRendererComponent>(); } else { _spriteRenderer = Graph.Entity.Get <SpriteRendererComponent>(); } }
protected RuntimeStateNode(StateGraphNode node, RuntimeStateGraph graph) { Node = node; Graph = graph; for (int i = 0; i < Node.Conditions.Count; i++) { var runtime = node.Conditions[i].GetRuntime(); if (runtime != null) { Conditions.Add(runtime); } } }
private void DrawNodes(RuntimeStateGraph graph) { if (graph == null) { return; } var currentNode = graph.Current?.Node; for (int i = 0; i < graph.OriginalGraph.Count; i++) { var node = graph.OriginalGraph.Nodes[i]; var maxWidth = node.Rect.x * 0.8f; var style = node == currentNode ? _nodeSelectedStyle : _nodeStyle; GUILayout.BeginArea(node.Rect, style); GUILayout.Space(10); GUILayout.Label(node.Title, _nodeTextStyle, GUILayout.MaxWidth(maxWidth)); GUILayout.Label("ID: " + node.Id, _nodeTextStyle, GUILayout.MaxWidth(maxWidth)); GUILayout.BeginHorizontal(); GUILayout.Space(20); GUILayout.Label("Enter"); EditorGUILayout.LabelField(node.EnterEvent); GUILayout.Label("Exit"); EditorGUILayout.LabelField(node.ExitEvent); GUILayout.Space(20); GUILayout.EndHorizontal(); GUILayout.Label(graph.GetRuntimeNode(node.Id).DebugInfo); GUILayout.EndArea(); var inSpacing = Mathf.Clamp(0.8f / node.InPoints.Count, 0.02f, 1); for (int c = 0; c < node.InPoints.Count; c++) { if (node.InPoints[c] == null) { node.InPoints.RemoveAt(c); break; } StateGraphExtensions.DrawConnectionPoint(node.InPoints[c], c, inSpacing, null, null); } var outSpacing = Mathf.Clamp(0.8f / node.OutPoints.Count, 0.02f, 1); for (int c = 0; c < node.OutPoints.Count; c++) { if (node.OutPoints[c] == null) { node.OutPoints.RemoveAt(c); break; } StateGraphExtensions.DrawConnectionPoint(node.OutPoints[c], c, outSpacing, null, null); } } }
public AnimationGraphComponent(RuntimeStateGraph value) { Value = value; }
public RuntimeConditionNode(ConditionNode node, RuntimeStateGraph graph) : base(node, graph) { }
public InstancedRuntimeAnimationNode(SpriteAnimationNode node, RuntimeStateGraph graph) : base (node, graph) { _simpleRenderer = graph.Entity.Get <SpriteSimpleRendererComponent>(); }
public override RuntimeStateNode GetRuntimeNode(RuntimeStateGraph graph) { return(new GlobalConditionRuntimeNode(this, graph)); }
public RuntimeNode(WeaponBobNode node, RuntimeStateGraph graph) : base(node, graph) { _node = node; _component = graph.Entity.Get <WeaponBobComponent>(); }
public abstract RuntimeStateNode GetRuntimeNode(RuntimeStateGraph graph);
public RuntimeNode(ReloadStateNode node, RuntimeStateGraph graph) : base(node, graph) { }
public RuntimeNode(MoveFpPivotNode node, RuntimeStateGraph graph) : base(node, graph) { _node = node; }
public RuntimeSpriteAnimationNode(SpriteAnimationNode node, RuntimeStateGraph graph) : base(node, graph) { _animNode = node; }
public DirectionalRuntimeAnimationNode(SpriteAnimationNode node, RuntimeStateGraph graph) : base (node, graph) { _billboard = graph.Entity.Get <SpriteBillboardComponent>(); }
public RuntimeSpriteAnimationNode(SpriteAnimationNode node, RuntimeStateGraph graph) : base(node, graph) { AnimNode = node; Renderer = graph.Entity.Get <SpriteRendererComponent>(); Animator = graph.Entity.Get <SpriteAnimatorComponent>(); }
// // public StateGraphNode GetConnectionEndpoint(ConnectionPoint point) { // for (int i = 0; i < Connections.Count; i++) { // if (Connections[i].GetIn().Id == point.Id) { // return Connections[i].OutNode; // } // } // return null; // } // // public void FillConnectionList(StateGraphNode node, List<Connection> connectList) { // for (int i = 0; i < Connections.Count; i++) { // if (Connections[i].InNode == node || Connections[i].OutNode == node) { // connectList.Add(Connections[i]); // } // } // } public RuntimeStateGraph GetRuntimeGraph(Entity entity) { var runtime = new RuntimeStateGraph(this, entity); return(runtime); }
public override RuntimeStateNode GetRuntimeNode(RuntimeStateGraph graph) { return(new RuntimeNode(this, graph)); }
public RuntimeStateGraph GetRuntimeGraph(RuntimeStateGraph parent, Entity entity) { var runtime = new RuntimeStateGraph(parent, this, entity); return(runtime); }
public RuntimeNode(BlockDamageNode node, RuntimeStateGraph graph) : base(node, graph) { _originalNode = node; }
public RuntimeSequenceNode(SequenceNode node, RuntimeStateGraph graph) : base(node, graph) { _sequence = node.Sequence.GetRuntimeSequence(graph.Entity); }
public RuntimeNode(CompletedGraphNode node, RuntimeStateGraph graph) : base(node, graph) { }
public RuntimeNode(MusclePoseNode node, RuntimeStateGraph graph) : base(node, graph) { _originalNode = node; }
public RuntimeNode(ChangeEquipmentNode node, RuntimeStateGraph graph) : base(node, graph) { _changeNode = node; }
public GlobalConditionRuntimeNode(GlobalConditionNode node, RuntimeStateGraph graph) : base(node, graph) { }
public RuntimeNode(WaitChargeNode node, RuntimeStateGraph graph) : base(node, graph) { _originalNode = node; }