add travel time

This commit is contained in:
Overside srl
2026-01-22 12:09:46 +01:00
parent e1a95d7417
commit d7f88649a7
25 changed files with 139 additions and 127 deletions

View File

@@ -1,30 +1,24 @@
extends Node
class_name GameState
var total_distance : float = 0.0
var initial_total_distance: float = 0.0
var total_time : int = 0
var initial_distance: float = 0.0
var initial_time: int = 0
func _ready() -> void:
add_to_group("state")
add_to_group("save_data")
func getTotalDistance() -> float:
return total_distance + initial_total_distance
func AddToTotalDistance(value :float):
total_distance =+ value
func SetInitialValue(value :float):
initial_total_distance = value
total_distance = value
func SetInitialValue(distance :float, time: int):
initial_distance = distance
initial_time = time
func save() -> Dictionary:
return {
"filename": get_scene_file_path(),
"parent": get_parent().get_path(),
"total_distance": getTotalDistance()
"total_distance": initial_distance + total_distance,
"total_time": initial_time + total_time
}