private void StepAtEndOfNode(Action onFinish) { switch (currentNode.type) { case FlowChartNodeType.Normal: MoveToNextNode(currentNode.next, onFinish); break; case FlowChartNodeType.Branching: ExecuteAction(DoBranch(currentNode.GetAllBranches(), onFinish)); break; case FlowChartNodeType.End: state = State.Ended; var endName = flowChartTree.GetEndName(currentNode); if (!checkpointManager.IsEndReached(endName)) { checkpointManager.SetEndReached(endName); } routeEnded.Invoke(new RouteEndedData(endName)); onFinish?.Invoke(); break; default: throw new ArgumentOutOfRangeException(); } }