24 lines
544 B
GDScript
24 lines
544 B
GDScript
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
|