extends Spatial const StateIdle = preload("res://scripts/oven/state/idle.gd") const StateCooking = preload("res://scripts/oven/state/cooking.gd") const StateHoldingItem = preload("res://scripts/oven/state/holding_item.gd") const StateBroken = preload("res://scripts/oven/state/broken.gd") export var cook_time: float = 2.0 export var broken: bool = false setget set_broken var state = null func _ready(): $cook_timer.wait_time = cook_time if broken: state = StateBroken.new() else: state = StateIdle.new() state.ctx = self state.enter_from(null) print("oven: NULL -> ", state.NAME) func set_broken(new_value: bool): if broken == new_value: return broken == new_value state.on_broken(broken) func change_state(new_state): print("oven: ", state.NAME, " -> ", new_state.NAME) new_state.ctx = self state.exit_to(new_state) new_state.enter_from(state) state = new_state func _on_coin_machine_coin_requirement_met(player): state.on_coin_machine_coin_requirement_met(player) func _on_cook_timer_timeout(): state.on_cook_timer_timeout() func _on_item_holder_item_changed(item): state.on_item_holder_item_changed(item) func _on_item_dump_item_dump_completed(): pass # Replace with function body.