Engine basic added

This commit is contained in:
PfandBoss
2022-12-10 02:03:09 +01:00
parent 86f9f1d2eb
commit 042576acff
3 changed files with 45 additions and 5 deletions

32
Engine.gd Normal file
View File

@@ -0,0 +1,32 @@
extends Module
class_name TrainEngine
enum STATE {RUNNING, DEAD}
#------------Methods-------------#
func _ready():
var root = get_tree().root.get_child(0)
maxStashValue = 100
currentStashValue = 100
currentState = STATE.RUNNING
#TODO: FINISH
func interact():
if currentState == STATE.RUNNING:
if currentStashValue < maxStashValue:
currentStashValue += 10
if currentStashValue > maxStashValue:
currentStashValue = maxStashValue
return
#TODO: Repair Train
currentState = STATE.RUNNING
if currentStashValue == 1 and currentState == STATE.INACTIVE:
currentState = STATE.SHOOTING
#TODO: SHOOTING
currentState = STATE.INACTIVE
return