class_name Statistics extends Node signal wave_finished signal wave_started var time_started var time_survived var wave_passed: int var in_wave_gap: bool var enemies_defeated: int var bullet_shoot: int @export var wave_gap_duration = 10 @export var wave_duration = 10 @export var wave_multiplier = 1.5 @export var wave_timer: Timer @export var wave_gap_timer: Timer func _ready(): time_started = Time.get_ticks_msec() time_survived = null wave_passed = 0 enemies_defeated = 0 bullet_shoot = 0 _on_wave_gap_passed() func _on_game_over(): time_survived = get_time_survived() func get_current_wave(): return wave_passed + 1 func get_current_wave_time(): if in_wave_gap: return get_current_wave_duration() - $WaveGapTimer.time_left else: return get_current_wave_duration() - $WaveTimer.time_left func get_current_wave_duration(): if in_wave_gap: return wave_gap_duration else: return wave_duration + wave_multiplier * wave_passed func get_time_survived(): if time_survived == null: return Time.get_ticks_msec() - time_started else: return time_survived func _on_enemy_defeated(): enemies_defeated += 1 func _on_wave_passed(): wave_passed += 1 in_wave_gap = true wave_finished.emit() wave_gap_timer.start(wave_gap_duration) func _on_wave_gap_passed(): in_wave_gap = false wave_started.emit() wave_timer.wait_time = get_current_wave_duration() wave_timer.start()