godot-plateformer/_scene/guard/Guard_CurrentActCheck.gd

22 lines
596 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.

'''
此类在触发时会尝试读取当前scene的id如果id和目标id匹配则通过检查
'''
class_name SG_CurrentIDCheck extends SceneGuard
##在此列表里的id如果当被监听的signal触发时我们当前scene的id属于此id则会通过check否则不通过
@export var check_pass_ids: Array[int] = [-1]
func check(signal_args: Array, manager: SceneManager) -> bool:
if not manager:
return false
var am := manager._act_manager
if not am:
return false
for id in check_pass_ids:
if am._current_act_id == id and id >= 0:
return true
return false