Added testing and save/load mechanic to the game. Game is now entering final phase.

This commit is contained in:
2026-05-09 21:25:36 +02:00
parent e7de2433de
commit 7e70471227
18 changed files with 1073 additions and 46 deletions
+32 -1
View File
@@ -155,6 +155,37 @@ public partial class Robot : Node3D
currentMessage = "";
}
public RobotSaveData CreateSaveData()
{
return new RobotSaveData
{
Name = Name,
CurrentProgram = currentProgram,
CurrentMessage = currentMessage,
RobotType = robotType,
X = Position.X,
Y = Position.Y,
Z = Position.Z,
Heat = heat,
Maintenance = maintenance,
IsCoolingDown = isCoolingDown,
IsBroken = isBroken
};
}
public void LoadSaveData(RobotSaveData saveData)
{
Name = saveData.Name;
currentProgram = saveData.CurrentProgram;
currentMessage = saveData.CurrentMessage ?? "";
robotType = saveData.RobotType ?? "stone_robot";
Position = new Vector3(saveData.X, saveData.Y, saveData.Z);
heat = saveData.Heat;
maintenance = saveData.Maintenance;
isCoolingDown = saveData.IsCoolingDown;
isBroken = saveData.IsBroken;
}
private bool CanExecute(double delta)
{
if (GameData.survival.isDead)
@@ -238,4 +269,4 @@ public partial class Robot : Node3D
isCoolingDown = false;
}
}
}
}