Reworked DSL for better architecture, implemented wall-phasing movement.
This commit is contained in:
+25
-4
@@ -1,18 +1,32 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Godot;
|
||||
|
||||
public partial class Robot : Node3D
|
||||
{
|
||||
public ProgramInterpreter interpreter;
|
||||
List<ProgramNode> nodes;
|
||||
bool isExecuting = false;
|
||||
ProgramNode currentNode;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
|
||||
if (isExecuting)
|
||||
{
|
||||
if (currentNode.Execute(this, delta))
|
||||
{
|
||||
currentNode = currentNode.nextNode;
|
||||
if (currentNode == null)
|
||||
{
|
||||
isExecuting = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public void Move()
|
||||
{
|
||||
@@ -21,7 +35,14 @@ public partial class Robot : Node3D
|
||||
|
||||
public void OnClicked()
|
||||
{
|
||||
GetNode<UIHandler>("/root/Main/CanvasLayer/UIHandler").ShowNamingPopup(this);
|
||||
GetNode<UIHandler>("/root/Main/CanvasLayer/UIHandler").ShowCodingWindow(this);
|
||||
}
|
||||
|
||||
public void SetupExecution(List<ProgramNode> nodes)
|
||||
{
|
||||
this.nodes = [.. nodes];
|
||||
isExecuting = true;
|
||||
currentNode = nodes[0];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ public partial class RobotList : PanelContainer
|
||||
display.OnRobotJumpTo += (robot) =>
|
||||
{
|
||||
EmitSignal(SignalName.OnRobotJumpTo, robot);
|
||||
Visible = false;
|
||||
};
|
||||
robotList.AddChild(display);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user