extends StaticBody3D class_name TheCube @export var max_health : int = 50 var health : int = max_health : set(value): health = value EventBus.cube_integrity_changed.emit(health) if health <= 0: death() static var money : int : set(value): money = value EventBus.money_changed.emit(money) func _ready() -> void: EventBus.player_has_won.connect(win) EventBus.cube_ready.emit.call_deferred(self) func take_damage(damage: int) -> void: health -= damage func win(): Transition.goto("res://UI/win_screen.tscn") static func spendMoney(amount : int) -> bool: if money > amount: money -= amount return true return false static func death(): EventBus.player_defeated.emit() Transition.goto("res://UI/defeat_screen.tscn")