Merge branch 'main' of github.com:PfandBoss/SemesterGameJam2022

This commit is contained in:
2022-12-10 03:31:48 +01:00
10 changed files with 27 additions and 23 deletions

32
scripts/Modules/Cannon.gd Normal file
View 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

25
scripts/Modules/Engine.gd Normal file
View File

@@ -0,0 +1,25 @@
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

47
scripts/Modules/Module.gd Normal file
View File

@@ -0,0 +1,47 @@
extends Node
class_name Module
#-----------Parameters----------------'
var currentStashValue = 0 : set = _set_currentStashValue, get = _get_currentStashValue
var maxStashValue = 0 : set = _set_maxStashValue, get = _get_maxStashValue
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}
#------------Methods-------------#
func interact():
pass
func _ready():
var root = get_tree().root.get_child(0)
#-----------Setter and Getter---------------#
func _set_currentStashValue(newValue):
currentStashValue = newValue
func _get_currentStashValue():
return currentStashValue
func _set_maxStashValue(newValue):
currentStashValue = newValue
func _get_maxStashValue():
return currentStashValue
func _set_level(newValue):
level = newValue
func _get_level():
return level
func _set_state(newValue):
currentState = newValue
func _get_state():
return currentState

View File

@@ -0,0 +1,23 @@
extends Module
class_name Storage
enum TYPE {AMMO, GUNPOWDER, FUEL}
@export var currentType: TYPE
#------------Methods-------------#
func _ready():
var root = get_tree().root.get_child(0)
root.ammo_pickup.connect(_on_signal_storing)
maxStashValue = 5
currentStashValue = 0
func interact():
if currentStashValue >= 1:
currentStashValue -= 1
return
func _on_signal_storing():
if currentStashValue < maxStashValue:
currentStashValue += 1
return