2024-09-08 23:15:20 +00:00
|
|
|
extends Node
|
2024-09-08 23:17:19 +00:00
|
|
|
|
|
|
|
@onready var globals = Data.data.globals
|
|
|
|
|
2024-09-10 13:03:27 +00:00
|
|
|
|
2024-09-08 23:17:19 +00:00
|
|
|
var game_time = 0
|
|
|
|
var last_flood_time = 0
|
|
|
|
var current_flood_state = 0
|
|
|
|
|
|
|
|
|
|
|
|
func _process(delta: float) -> void:
|
2024-09-15 08:43:56 +00:00
|
|
|
if not Persister.get_value("game_started") or Persister.get_value("win") or Persister.get_value("lose"):
|
2024-09-15 05:37:02 +00:00
|
|
|
return
|
|
|
|
|
2024-09-08 23:17:19 +00:00
|
|
|
game_time += delta
|
2024-09-15 08:43:56 +00:00
|
|
|
Persister.persist_data("game_time", int(game_time * 1000))
|
2024-09-08 23:17:19 +00:00
|
|
|
|
|
|
|
if last_flood_time + globals.time_to_flood_change < game_time:
|
|
|
|
last_flood_time += globals.time_to_flood_change
|
|
|
|
current_flood_state += 1
|
|
|
|
|
2024-09-15 08:43:56 +00:00
|
|
|
Persister.change_value("days", 1)
|
|
|
|
|
|
|
|
if current_flood_state > globals.flood_levels.size():
|
|
|
|
Persister.persist_data("win", true)
|
|
|
|
return
|
|
|
|
|
2024-09-09 01:17:35 +00:00
|
|
|
Persister.persist_data("flood_level", globals.flood_levels[current_flood_state])
|