Added survival mechanic that consumes inventory items if needed.

This commit is contained in:
2026-05-09 12:22:04 +02:00
parent 8a79a3474e
commit 9f32152fb8
11 changed files with 356 additions and 25 deletions
+14
View File
@@ -15,6 +15,7 @@ public partial class World : Node3D
public override void _Ready()
{
ResetRunState();
WFC.FillAdjacencies();
tileMeshes = ResourceLoader.LoadTiles();
@@ -78,6 +79,7 @@ public partial class World : Node3D
public override void _Process(double delta)
{
GameData.survival.Update(delta);
if (!canMove) return;
if (Input.IsActionJustPressed("layer_up") && currentLayer > 0) currentLayer--;
@@ -89,6 +91,18 @@ public partial class World : Node3D
}
}
private void ResetRunState()
{
survival = new SurvivalState();
inventory = new Inventory();
availableResearch = ResourceLoader.LoadResearch();
robots.Clear();
currentLayer = 0;
visibleLayer = 0;
lowestLayer = 0;
canMove = true;
}
private void GenerateWorld()
{
for (int layer = 0; layer < ruinSize; layer++)