Attempt2/lib/classes/state.gd

54 lines
1.3 KiB
GDScript3

class_name State
extends Resource
export var debug_state: bool = false
export var timeout_seconds: float = 0.0
signal state_entered()
signal state_exited()
# Declare member variables here. Examples:
var state_timeout: Timer
var state_ready: bool = true
var name: String
# Called when the node enters the scene tree for the first time.
# Resources don't have _ready callbacks I think
# You'd have to use the constructor callback _init
#func _ready():
# pass # Replace with function body.
#func _init():
# print ("Am I really a parent's constructor?")
func _init():
##TODO: this bit me in the butt. Should add a safety or something.
# Only add timout node if timer value was specified.
if(timeout_seconds > 0.0):
state_timeout = Timer.new()
state_timeout.wait_time = timeout_seconds
state_timeout.one_shot = true
state_timeout.autostart = false
#add_child(state_timeout)
#get_tree().get_root().add_child(state_timeout)
#TODO: Need to figure out how to add this to tree
print ("State init called for no reason?")
#modifier = StateModifier.new()
func enter() -> void:
pass
func exit() -> void:
pass
func process_input(_event: InputEvent) -> String:
return ''
func process_frame(_delta: float) -> String:
return ''
func process_physics(_delta: float) -> String:
return ''