despawn runner or chaser on disconnect
This commit is contained in:
@@ -9,42 +9,27 @@ func set_subject(new_subject: Node) -> void:
|
||||
state.subject = subject
|
||||
|
||||
func _change_state(new_state: State) -> void:
|
||||
if current_state:
|
||||
#print("Exiting: %s" % current_state.name)
|
||||
current_state.exit()
|
||||
if current_state: current_state.exit()
|
||||
|
||||
current_state = new_state
|
||||
#print("Entering: %s" % current_state.name)
|
||||
current_state.enter()
|
||||
|
||||
func process_physics(delta: float) -> void:
|
||||
if not current_state:
|
||||
return
|
||||
|
||||
if not current_state.subject:
|
||||
return
|
||||
if not current_state or not current_state.subject: return
|
||||
|
||||
var new_state = current_state.process_physics(delta)
|
||||
if new_state:
|
||||
_change_state(new_state)
|
||||
|
||||
func process_input(event: InputEvent) -> void:
|
||||
if not current_state:
|
||||
return
|
||||
|
||||
if not current_state.subject:
|
||||
return
|
||||
if not current_state or not current_state.subject: return
|
||||
|
||||
var new_state = current_state.process_input(event)
|
||||
if new_state:
|
||||
_change_state(new_state)
|
||||
|
||||
func process_frame(delta: float) -> void:
|
||||
if not current_state:
|
||||
return
|
||||
|
||||
if not current_state.subject:
|
||||
return
|
||||
if not current_state or not current_state.subject: return
|
||||
|
||||
var new_state = current_state.process_frame(delta)
|
||||
if new_state:
|
||||
|
||||
Reference in New Issue
Block a user