mirror of
https://github.com/PfandBoss/SemesterGameJam2022.git
synced 2025-11-12 12:16:14 +01:00
Merge branch 'main' of https://github.com/PfandBoss/SemesterGameJam2022
This commit is contained in:
32
scripts/Modules/Cannon.gd
Normal file
32
scripts/Modules/Cannon.gd
Normal file
@@ -0,0 +1,32 @@
|
||||
extends Module
|
||||
|
||||
class_name Cannon
|
||||
|
||||
enum STATE {INACTIVE, RELOADING, SHOOTING}
|
||||
|
||||
#------------Methods-------------#
|
||||
func _ready():
|
||||
var root = get_tree().root.get_child(0)
|
||||
root.shoot.connect(_on_signal_shooting)
|
||||
maxStashValue = 1
|
||||
currentStashValue = 0
|
||||
currentState = STATE.INACTIVE
|
||||
#TODO: FINISH
|
||||
func interact():
|
||||
if currentState == STATE.INACTIVE:
|
||||
#TODO: RELOADING
|
||||
if currentStashValue < maxStashValue:
|
||||
currentState = STATE.RELOADING
|
||||
currentStashValue += 1
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
func _on_signal_shooting():
|
||||
print("hit")
|
||||
if currentStashValue >= 1 and currentState == STATE.INACTIVE:
|
||||
currentState = STATE.SHOOTING
|
||||
currentStashValue -= 1
|
||||
#TODO: SHOOTING
|
||||
currentState = STATE.INACTIVE
|
||||
return
|
||||
Reference in New Issue
Block a user