Summary (required)

This commit is contained in:
Arthur
2022-12-10 02:22:52 +01:00
parent d049e3c1ae
commit 359c3cf1f1
3 changed files with 29 additions and 11 deletions

View File

@@ -17,15 +17,15 @@ func interact():
#TODO: RELOADING #TODO: RELOADING
if currentStashValue < maxStashValue: if currentStashValue < maxStashValue:
currentState = STATE.RELOADING currentState = STATE.RELOADING
currentStashValue = maxStashValue ++currentStashValue
return return
return return
func _on_signal_shooting(): func _on_signal_shooting():
if currentStashValue == 1 and currentState == STATE.INACTIVE: if currentStashValue >= 1 and currentState == STATE.INACTIVE:
currentState = STATE.SHOOTING currentState = STATE.SHOOTING
--currentStashValue
#TODO: SHOOTING #TODO: SHOOTING
currentState = STATE.INACTIVE currentState = STATE.INACTIVE
return return

View File

@@ -1,11 +1,23 @@
extends "res://Module.gd" extends Module
class_name Storage
# Called when the node enters the scene tree for the first time. enum TYPE {AMMO, GUNPOWDER, FUEL}
@export var currentType: TYPE
#------------Methods-------------#
func _ready(): func _ready():
pass # Replace with function body. var root = get_tree().root.get_child(0)
root.shooting.connect(_on_signal_storing)
maxStashValue = 5
# Called every frame. 'delta' is the elapsed time since the previous frame. currentStashValue = 0
func _process(delta): func interact():
pass if currentStashValue >= 1:
--currentStashValue
return
func _on_signal_storing():
if currentStashValue < maxStashValue:
++currentStashValue
return

View File

@@ -20,6 +20,11 @@ _global_script_classes=[{
"path": "res://Module.gd" "path": "res://Module.gd"
}, { }, {
"base": "Module", "base": "Module",
"class": &"Storage",
"language": &"GDScript",
"path": "res://Storage.gd"
}, {
"base": "Module",
"class": &"TrainEngine", "class": &"TrainEngine",
"language": &"GDScript", "language": &"GDScript",
"path": "res://Engine.gd" "path": "res://Engine.gd"
@@ -27,6 +32,7 @@ _global_script_classes=[{
_global_script_class_icons={ _global_script_class_icons={
"Cannon": "", "Cannon": "",
"Module": "", "Module": "",
"Storage": "",
"TrainEngine": "" "TrainEngine": ""
} }