38 lines
1.0 KiB
GDScript
38 lines
1.0 KiB
GDScript
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
|
|
|
|
export(Array, String) var animation_sequence
|
|
export(Array, NodePath) var transition_state_nodes
|
|
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 _update():
|
|
pass
|