Files
Kalulu/resources/user/user_difficulty.gd
T
2025-09-05 15:55:48 +02:00

23 lines
785 B
GDScript

class_name UserDifficulty
extends Resource
signal difficulty_changed()
# Stores the user history for all the minigames
# Key -> minigame_name: String
# Value -> UserMinigameHistory
@export var minigames_histories: Dictionary = {}
# Gets the difficulty of the user for the given minigame
func get_difficulty(minigame_name: String) -> int:
return minigames_histories.get(minigame_name, UserMinigameHistory.new()).difficulty
# Adds a game to the minigame history of the user and update difficulty if needed
func add_game(minigame_name: String, minigame_won: bool) -> void:
var history: UserMinigameHistory = minigames_histories.get(minigame_name, UserMinigameHistory.new())
history.add_game(minigame_won)
minigames_histories[minigame_name] = history
difficulty_changed.emit()