class

PointClickEngine::Core::GameStateManager

Inherits YAML::Serializable < JSON::Serializable < Reference < Object

Game state manager handles all persistent game state

Constructors

new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
Source
new(pull : JSON::PullParser)
Source
new(event_bus : Events::EventBus)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source
new(*, __context_for_yaml_serializable ctx : YAML::ParseContext, __node_for_yaml_serializable node : YAML::Nodes::Node)
Source

Instance methods

active_quests

Quest and achievement tracking

Source
active_quests=(active_quests : Hash(String, String))

Quest and achievement tracking

Source
add_change_handler(handler : StateChangeHandler)

Event system

Source
advance_quest(quest_id : String, next_step : String)
Source
change_handlers

Event handling (legacy callbacks)

Source
change_handlers=(change_handlers : Array(StateChangeHandler))

Event handling (legacy callbacks)

Source
check_condition(condition : String) : Bool

Condition evaluation

Source
complete_quest(quest_id : String)
Source
completed_quests
Source
completed_quests=(completed_quests : Array(String))
Source
day_cycle
Source
day_cycle=(day_cycle : Float32)
Source
debug_dump

Debug utilities

Source
evaluate_condition(condition : String) : ConditionResult

Advanced condition parsing

Source
event_bus

Optional EventBus for publishing typed events

Source
event_bus=(event_bus : Events::EventBus | Nil)

Optional EventBus for publishing typed events

Source
flags

Core state storage

Source
flags=(flags : Hash(String, Bool))

Core state storage

Source
game_time

Game time tracking

Source
game_time=(game_time : Float32)

Game time tracking

Source
get_flag(name : String) : Bool
Source
get_quest_step(quest_id : String) : String | Nil
Source
get_time_of_day
Source
get_timer(name : String) : Float32 | Nil
Source
get_variable(name : String) : GameValue | Nil
Source
get_variable_as(name : String, type : T.class) : T | Nil forall T
Source
has_flag?(name : String) : Bool
Source
has_timer?(name : String) : Bool
Source
is_achievement_unlocked?(achievement_id : String) : Bool
Source
is_day?
Source
is_night?
Source
is_quest_active?(quest_id : String) : Bool
Source
is_quest_completed?(quest_id : String) : Bool
Source
load_from_file(path : String) : Bool
Source
remove_change_handler(handler : StateChangeHandler)
Source
save_to_file(path : String) : Bool

Save/Load

Source
set_flag(name : String, value : Bool)

Flag management

Source
set_timer(name : String, duration : Float32)

Timer management

Source
set_variable(name : String, value : GameValue)

Variable management

Source
start_quest(quest_id : String, initial_step : String = "start")

Quest management

Source
timers
Source
timers=(timers : Hash(String, Float32))
Source
unlock_achievement(achievement_id : String)

Achievement management

Source
unlocked_achievements
Source
unlocked_achievements=(unlocked_achievements : Array(String))
Source
update_game_time(dt : Float32)

Time management

Source
update_timers(dt : Float32)
Source
variables
Source
variables=(variables : Hash(String, GameValue))
Source