Updated item_generator to have states. Also made it extend Damageable class and added a broken state

This commit is contained in:
akshay committed 2022-08-18 03:26:58 -04:00
1 parent 14eb5b24de
commit 6e6da14975
9 files changed
+260 -70

No files matched your search

+1 -2
View File
@@ -69,5 +69,4 @@ func _on_item_dump_item_dump_completed():
func take_damage(damage : int = 1):
.take_damage(damage)
if state != null:
state.on_damage_taken()
state.on_damage_taken()
@@ -50,4 +50,5 @@ func on_item_holder_item_changed(item):
func on_damage_taken():
if ctx.current_hp <= 0:
ctx.gen_timer.stop()
ctx.change_state(ctx.States[ctx.EState.BROKEN].new())