From f9839eb6fb1f922fd8207b32cb5873af07b8e191 Mon Sep 17 00:00:00 2001 From: PfandBoss <68470553+PfandBoss@users.noreply.github.com> Date: Sat, 10 Dec 2022 01:11:36 +0100 Subject: [PATCH] Blub --- Cannon.gd | 19 ++++++++++++++++--- Module.gd | 6 +++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Cannon.gd b/Cannon.gd index 841fef3..da77fe3 100644 --- a/Cannon.gd +++ b/Cannon.gd @@ -2,10 +2,23 @@ extends Module class_name Cannon - - +enum STATE {INACTIVE, RELOADING, SHOOTING} #------------Methods-------------# - +func _ready(): + var root = get_tree().root.get_child(0) + root.timeout.connect("shooting",self,"_on_signal_shooting") + maxStashValue = 1 + currentStashValue = 0 + currentState = STATE.INAKTIVE #TODO: FINISH func interact(): + if currentState == STATE.INACTIVE: + if currentStashValue < maxStashValue: + currentState = STATE.RELOADING + currentStashValue = maxStashValue + return + + return + +func _on_signal_shooting(): pass diff --git a/Module.gd b/Module.gd index 2867d47..e3517f7 100644 --- a/Module.gd +++ b/Module.gd @@ -11,6 +11,8 @@ var currentState = null : set = _set_state, get = _get_state var level = 0 : set = _set_level, get = _get_level + + enum MODULE_TYPE {CANNON, STEERING, ENGINE, STORAGE} @@ -22,7 +24,9 @@ func interact(): pass - +func _ready(): + emit_signal("MODULE") + #-----------Setter and Getter---------------# func _set_currentStashValue(newValue):