Big project cleanup with overhaul of file responsibilities (KISS) and code (DRY, YAGNI)
This commit is contained in:
@@ -9,11 +9,12 @@ public class ForNode : ProgramNode
|
||||
{
|
||||
DisplayText = "For";
|
||||
}
|
||||
|
||||
public override NodeResult Execute(Robot robot, double delta)
|
||||
{
|
||||
bool isConditionFulfilled = DetermineCondition();
|
||||
amountExecuted++;
|
||||
return isConditionFulfilled? NodeResult.SUCCESS : NodeResult.CONDITIONFALSE;
|
||||
return isConditionFulfilled ? NodeResult.SUCCESS : NodeResult.CONDITIONFALSE;
|
||||
}
|
||||
|
||||
private bool DetermineCondition()
|
||||
@@ -41,21 +42,6 @@ public class ForNode : ProgramNode
|
||||
Dictionary<StringName, ProgramNode> availableNodes
|
||||
)
|
||||
{
|
||||
nextNode = null;
|
||||
NegativeNode = null;
|
||||
|
||||
foreach (Godot.Collections.Dictionary connection in connections)
|
||||
{
|
||||
int port = (int)connection["from_port"];
|
||||
ProgramNode connectedNode = GetConnectedNode(connection, availableNodes);
|
||||
if (port == 0)
|
||||
{
|
||||
nextNode = connectedNode;
|
||||
}
|
||||
else
|
||||
{
|
||||
NegativeNode = connectedNode;
|
||||
}
|
||||
}
|
||||
SetBranchNodes(connections, availableNodes);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user