godot-plateformer/_scene/guard/ActIDChanged/Guard_ActIDChangedCheck.gd

24 lines
544 B
GDScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

extends SceneGuard
##如果为-1则不检查from_id只检查to id
@export var from_id: int = -1
##如果为-1不检查如果不为-1则如果act manager的act changed的to act是此id此guard通过。
@export var to_id: int = -1
func check(signal_args: Array) -> bool:
if to_id < 0:
return true
var has_from : bool = false
if from_id >= 0:
has_from = true
if has_from:
if signal_args[0] == from_id and signal_args[1] == to_id:
return true
else:
if signal_args[1] == to_id:
return true
return false