private IEnumerator FollowSuccession(IGraph graph, INode node, IFlowPort port) { PullData(graph, node); //Debug.Log($"Triggering: '{node}.{port}'"); port.Trigger(this); if (!port.HasSuccession) { yield break; } if (port.IsAsync) { var succession = port.AsyncSuccession(this); while (succession.MoveNext()) { if (succession.Current is IFlowPort successionPort) { //Debug.Log($"Following Succession from '{node}.{port}' to '{node}.{successionPort}'"); SetData(node); yield return(FollowConnections(graph, node, successionPort)); } yield return(succession.Current); } } else { var successionPort = port.SerialSuccession(this); //Debug.Log($"Following Succession from '{node}.{port}' to '{node}.{successionPort}'"); SetData(node); yield return(FollowConnections(graph, node, successionPort)); } }
private IEnumerator FollowConnections(IGraph graph, INode node, IFlowPort port) { //Debug.Log($"Triggering: '{node}.{port}'"); port.Trigger(this); foreach (var connection in node.GetFlowConnections(port.Id)) { var nextNode = graph.GetNode(connection.TargetNode); var nextPort = nextNode.GetFlowPort(connection.TargetPort); //Debug.Log($"Following Connection from '{node}.{port}' to '{nextNode}.{nextPort}'"); _cycles += 1; if (_cycles > 250) { _cycles = 0; yield return(null); } _stack += 1; yield return(FollowSuccession(graph, nextNode, nextPort)); } }