class_name StateModifier
extends Node
## State modification
##
## A state modifier doesn't have any direct control of a game object. 
## They are transfered from the enter and exit of other states and 
## influence the movement or animation of their parent states. 
## Rather than going full into paralell state machines I hope that this 
## modifier will be suitable for a basic state machine.
##
## @WIP


export var animation_name: String
export var move_speed: float = 60
export var timeout_seconds: float = 0.0

# Attempting to use this as an animation suffix that can linger after
# state transition like 'run-fire' to 'idle-fire' 'jump-fire' etc.
export var animation_suffix: bool = false

# not sure if I can do the array thing from state change. Maybe? 
# disabling this sequencing for now. 
# export(Array, String) var animation_sequence
# var animation_index: int = 0
# var current_animation_sequence: int = 0

var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")

#var animation_sequence_timer: Timer

var state_timeout: Timer

func _ready():
	state_timeout = Timer.new()
	state_timeout.wait_time = timeout_seconds
	state_timeout.one_shot = true
	state_timeout.autostart = false
	add_child(state_timeout)

func enter() -> void:
	print("Apply State Modifier: ", self.name)
	state_timeout.start()
	#modifier_stack_ref = state_modifiers
	return

func exit() -> void:
	pass

func _update():
	pass
