Refactor player animation and collision based entrances
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
extends Node
|
||||
class_name PlayerStateMachine
|
||||
|
||||
signal StateChanged
|
||||
signal StateChanged(to_state: States, from_state: States)
|
||||
|
||||
enum States {
|
||||
UNSET, IDLE, WALKING, USING_ITEM_A, DRAWING_BOW, FIRING_ARROW,
|
||||
@@ -52,6 +52,9 @@ func _process(delta: float) -> void:
|
||||
|
||||
|
||||
func _swap_state() -> void:
|
||||
var from_state := current_state.GetStateEnum()
|
||||
var to_state := queued_state
|
||||
|
||||
if current_state:
|
||||
current_state.Exit()
|
||||
|
||||
@@ -60,4 +63,4 @@ func _swap_state() -> void:
|
||||
queued_state = PlayerStateMachine.States.UNSET
|
||||
queued_parameters = {}
|
||||
|
||||
StateChanged.emit()
|
||||
StateChanged.emit(to_state, from_state)
|
||||
|
||||
Reference in New Issue
Block a user