Cleaned up project with better structure.

This commit is contained in:
2026-05-09 11:29:48 +02:00
parent 1ad3454f6a
commit 6708aa277f
95 changed files with 711 additions and 700 deletions
+53
View File
@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using Godot;
public partial class Robot : Node3D
{
private List<ProgramNode> nodes = new List<ProgramNode>();
private bool isExecuting = false;
private ProgramNode currentNode;
public string currentProgram;
public string currentMessage = "";
public override void _Process(double delta)
{
if (isExecuting)
{
switch (currentNode.Execute(this, delta))
{
case NodeResult.SUCCESS:
currentNode = currentNode.nextNode;
if (currentNode == null)
{
isExecuting = false;
}
break;
case NodeResult.FAILURE:
isExecuting = false;
currentMessage = "(FAILED)" + currentNode.lastExecutionMessage;
break;
case NodeResult.RUNNING:
currentMessage = "";
break;
}
}
else if (currentMessage.Length <= 0)
{
currentMessage = "No script executing";
}
Visible = Math.Round(Math.Abs(Position.Y / GameData.tileHeight), 0) == GameData.visibleLayer;
}
public void SetupExecution(List<ProgramNode> nodes)
{
if (nodes.Count <= 0) return;
this.nodes = new List<ProgramNode>(nodes);
isExecuting = true;
currentNode = nodes[0];
}
}