Reworked node display and worked on DSL interpretation
This commit is contained in:
@@ -6,9 +6,16 @@ public class CraftNode : ProgramNode
|
||||
{
|
||||
DisplayText = "Craft";
|
||||
}
|
||||
public override void Execute(Robot robot)
|
||||
public override bool Execute(Robot robot)
|
||||
{
|
||||
GD.Print("Craft");
|
||||
nextNode.Execute(robot);
|
||||
if (nextNode != null)
|
||||
{
|
||||
return nextNode.Execute(robot);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,16 @@ public class HarvestNode : ProgramNode
|
||||
{
|
||||
DisplayText = "Harvest";
|
||||
}
|
||||
public override void Execute(Robot robot)
|
||||
public override bool Execute(Robot robot)
|
||||
{
|
||||
GD.Print("Harvest");
|
||||
nextNode.Execute(robot);
|
||||
if (nextNode != null)
|
||||
{
|
||||
return nextNode.Execute(robot);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,16 @@ public class MoveNode : ProgramNode
|
||||
{
|
||||
DisplayText = "Move";
|
||||
}
|
||||
public override void Execute(Robot robot)
|
||||
public override bool Execute(Robot robot)
|
||||
{
|
||||
robot.Position = targetPosition;
|
||||
nextNode.Execute(robot);
|
||||
if (nextNode != null)
|
||||
{
|
||||
return nextNode.Execute(robot);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ public abstract class ProgramNode
|
||||
|
||||
}
|
||||
|
||||
public abstract void Execute(Robot robot);
|
||||
public abstract bool Execute(Robot robot);
|
||||
public void LinkNode(ProgramNode nextNode)
|
||||
{
|
||||
this.nextNode = nextNode;
|
||||
|
||||
Reference in New Issue
Block a user