Files
RuinAdventurer/Scripts/Robot/Robot.cs
T

49 lines
750 B
C#

using System.Collections.Generic;
using System.Threading.Tasks;
using Godot;
public partial class Robot : Node3D
{
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()
{
}
public void OnClicked()
{
GetNode<UIHandler>("/root/Main/CanvasLayer/UIHandler").ShowCodingWindow(this);
}
public void SetupExecution(List<ProgramNode> nodes)
{
this.nodes = [.. nodes];
isExecuting = true;
currentNode = nodes[0];
}
}