diff --git a/StormManager.tscn b/StormManager.tscn new file mode 100644 index 0000000..f4721f0 --- /dev/null +++ b/StormManager.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://n2lpy72tkyc8"] + +[ext_resource type="Script" path="res://storm_manager.gd" id="1_wwjtb"] + +[node name="StormManager" type="Node"] +script = ExtResource("1_wwjtb") diff --git a/parts/globals.txt b/parts/globals.txt new file mode 100644 index 0000000..eade4d8 --- /dev/null +++ b/parts/globals.txt @@ -0,0 +1 @@ +time_to_flood_change: 5 diff --git a/storm_manager.gd b/storm_manager.gd new file mode 100644 index 0000000..61cc8ce --- /dev/null +++ b/storm_manager.gd @@ -0,0 +1,33 @@ +extends Node + +@onready var globals = Data.data.globals + + +var game_time = 0 +var last_flood_time = 0 +var current_flood_state = 0 + +var flood_levels = [ + 0, + 1, + 0, + 2, + 1, + 3, + 1, + 0, + 2, + 1, + 4, + 2, + 5 +] + +func _process(delta: float) -> void: + game_time += delta + + if last_flood_time + globals.time_to_flood_change < game_time: + last_flood_time += globals.time_to_flood_change + current_flood_state += 1 + + Persister.persist_data("flood_level", flood_levels[current_flood_state])