Added testing and save/load mechanic to the game. Game is now entering final phase.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user