(WIP) Switch from previous DSL System (UI order based) to a new DSL System (node connection based) still in Progress.
This commit is contained in:
@@ -1,13 +1,37 @@
|
||||
using Godot;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public abstract class ProgramNode
|
||||
{
|
||||
public ProgramNode nextNode;
|
||||
public ProgramNode previousNode;
|
||||
public ProgramNode NegativeNode;
|
||||
public string DisplayText;
|
||||
public string lastExecutionMessage;
|
||||
|
||||
public abstract NodeResult Execute(Robot robot, double delta);
|
||||
public abstract ProgramNode Duplicate();
|
||||
public abstract string Save();
|
||||
|
||||
public virtual void SetNextNode(
|
||||
List<Godot.Collections.Dictionary> connections,
|
||||
Dictionary<StringName, ProgramNode> availableNodes
|
||||
)
|
||||
{
|
||||
nextNode = null;
|
||||
|
||||
if (connections.Count <= 0) return;
|
||||
|
||||
nextNode = GetConnectedNode(connections[0], availableNodes);
|
||||
}
|
||||
|
||||
protected ProgramNode GetConnectedNode(
|
||||
Godot.Collections.Dictionary connection,
|
||||
Dictionary<StringName, ProgramNode> availableNodes
|
||||
)
|
||||
{
|
||||
StringName nodeName = connection["to_node"].AsStringName();
|
||||
if (!availableNodes.ContainsKey(nodeName)) return null;
|
||||
|
||||
return availableNodes[nodeName];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user