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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ using System.Collections.Generic;
|
||||
|
||||
public class RobotStats
|
||||
{
|
||||
public readonly Dictionary<string, RobotTypeStats> RobotTypes = new()
|
||||
public readonly Dictionary<string, RobotTypeStats> RobotTypes = new Dictionary<string, RobotTypeStats>
|
||||
{
|
||||
["stone_robot"] = new RobotTypeStats(0.75f, 0.60f, 0.80f, 0.80f, 1.40f, -0.10f),
|
||||
["copper_robot"] = new RobotTypeStats(1.00f, 1.00f, 1.00f, 1.00f, 1.00f, 0.00f),
|
||||
["tin_robot"] = new RobotTypeStats(1.00f, 1.00f, 1.00f, 1.00f, 1.00f, 0.00f),
|
||||
["bronze_robot"] = new RobotTypeStats(1.15f, 1.10f, 0.90f, 1.10f, 0.80f, 0.05f),
|
||||
["iron_robot"] = new RobotTypeStats(1.35f, 1.25f, 1.15f, 1.20f, 0.65f, 0.10f)
|
||||
{ "stone_robot", new RobotTypeStats(0.75f, 0.60f, 0.80f, 0.80f, 1.40f, -0.10f) },
|
||||
{ "copper_robot", new RobotTypeStats(1.00f, 1.00f, 1.00f, 1.00f, 1.00f, 0.00f) },
|
||||
{ "tin_robot", new RobotTypeStats(1.00f, 1.00f, 1.00f, 1.00f, 1.00f, 0.00f) },
|
||||
{ "bronze_robot", new RobotTypeStats(1.15f, 1.10f, 0.90f, 1.10f, 0.80f, 0.05f) },
|
||||
{ "iron_robot", new RobotTypeStats(1.35f, 1.25f, 1.15f, 1.20f, 0.65f, 0.10f) }
|
||||
};
|
||||
private const float BaseMinimumEfficiency = 0.35f;
|
||||
|
||||
@@ -86,7 +86,7 @@ public class RobotStats
|
||||
break;
|
||||
case "robot_count_increase":
|
||||
GameData.maxRobotCount += (int)effect.Value;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user