36 lines
766 B
GDScript
36 lines
766 B
GDScript
extends Reference
|
|
|
|
const NAME = "idle"
|
|
|
|
var ctx = null
|
|
|
|
func _init():
|
|
pass
|
|
|
|
func enter_from(state):
|
|
ctx.get_node("coin_machine").enabled = true
|
|
ctx.get_node("item_holder").add_enabled = true
|
|
ctx.get_node("item_holder").remove_enabled = true
|
|
ctx.status_light.idle()
|
|
ctx.item_dump.enabled = false
|
|
|
|
func exit_to(state):
|
|
pass
|
|
|
|
func on_coin_machine_coin_requirement_met(player):
|
|
ctx.change_state(ctx.StateGrowing.new())
|
|
|
|
func on_grow_timer_timeout():
|
|
assert(false, "grow timer shouldn't trigger while idle")
|
|
|
|
func on_item_holder_item_changed(item):
|
|
assert(item != null)
|
|
ctx.change_state(ctx.StateBlocked.new())
|
|
|
|
func on_item_dump_item_dump_completed():
|
|
assert(false)
|
|
|
|
func on_damage_taken():
|
|
if ctx.current_hp <= 0:
|
|
ctx.change_state(ctx.StateBroken.new())
|