Init
This commit is contained in:
30
scripts/gamestate.gd
Normal file
30
scripts/gamestate.gd
Normal file
@@ -0,0 +1,30 @@
|
||||
extends Node
|
||||
class_name GameState
|
||||
|
||||
var total_distance : float = 0.0
|
||||
var initial_total_distance: float = 0.0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
add_to_group("state")
|
||||
|
||||
|
||||
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 save() -> Dictionary:
|
||||
return {
|
||||
"filename": get_scene_file_path(),
|
||||
"parent": get_parent().get_path(),
|
||||
"total_distance": getTotalDistance()
|
||||
}
|
||||
Reference in New Issue
Block a user