mirror of
https://github.com/PfandBoss/SemesterGameJam2022.git
synced 2025-11-12 04:16:12 +01:00
delete gitignore files
This commit is contained in:
38
scripts/Modules/Cannon.gd
Normal file
38
scripts/Modules/Cannon.gd
Normal file
@@ -0,0 +1,38 @@
|
||||
extends Module
|
||||
|
||||
class_name Cannon
|
||||
|
||||
enum STATE {INACTIVE, RELOADING, SHOOTING}
|
||||
|
||||
var CAN_ENGAGE = true
|
||||
var DAMAGE = 5
|
||||
@onready var train = get_parent() as Train
|
||||
|
||||
#------------Methods-------------#
|
||||
func _ready():
|
||||
maxStashValue = 1
|
||||
currentStashValue = 1
|
||||
currentState = STATE.INACTIVE
|
||||
#TODO: FINISH
|
||||
func interact():
|
||||
if currentState == STATE.INACTIVE:
|
||||
#TODO: RELOADING
|
||||
if currentStashValue < maxStashValue:
|
||||
currentState = STATE.RELOADING
|
||||
currentStashValue += 1
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
func shoot():
|
||||
if not CAN_ENGAGE:
|
||||
return false
|
||||
CAN_ENGAGE = false
|
||||
create_tween().tween_callback(func(): CAN_ENGAGE = true).set_delay(2)
|
||||
|
||||
if currentStashValue >= 1 and currentState == STATE.INACTIVE:
|
||||
currentState = STATE.SHOOTING
|
||||
currentStashValue -= 1
|
||||
currentState = STATE.INACTIVE
|
||||
return true
|
||||
return false
|
||||
25
scripts/Modules/Engine.gd
Normal file
25
scripts/Modules/Engine.gd
Normal 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
47
scripts/Modules/Module.gd
Normal 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
|
||||
25
scripts/Modules/Storage.gd
Normal file
25
scripts/Modules/Storage.gd
Normal file
@@ -0,0 +1,25 @@
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user