iFactory.Godot/BITKit/Scripts/GraphNode/GraphFlowService.cs

37 lines
806 B
C#

using Godot;
using System;
using Godot.Collections;
namespace BITKit;
public partial class GraphFlowService : Node
{
[Export] private Godot.Collections.Dictionary<int,NodePath> nodes;
[Export] private int currentIndex = -1;
public override void _Ready()
{
if (currentIndex is not -1 && currentIndex < nodes.Count)
Entry(GetGraphNode(nodes[currentIndex]));
}
private void EntryNext()
{
if ((currentIndex + 1) >= nodes.Count) return;
currentIndex++;
Entry(GetGraphNode(nodes[currentIndex]));
}
private void Entry(GraphNode node)
{
foreach (var _node in nodes)
{
GetGraphNode(_node.Value).Overlay = GraphNode.OverlayEnum.Disabled;
}
node.Overlay = GraphNode.OverlayEnum.Position;
}
GraphNode GetGraphNode(string nodePath)
{
return GetNode<GraphNode>(nodePath);
}
}