33 lines
893 B
GDScript

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")
export var cook_time: float = 2.0
var state = null
func _ready():
$cook_timer.wait_time = cook_time
state = StateIdle.new()
state.ctx = self
state.enter_from(null)
print("hydroponics_station: NULL -> ", state.NAME)
func change_state(new_state):
print("hydroponics_station: ", 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)