mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-23 03:52:30 +08:00
refactor(TickTool): 简化until方法的对象有效性检查
移除临时变量obj,直接在循环条件中调用predicate.get_object(),使代码更简洁
This commit is contained in:
@@ -6,8 +6,7 @@ static func frame(count: int = 1):
|
|||||||
for i in range(count):
|
for i in range(count):
|
||||||
await WorldManager.tree.physics_frame
|
await WorldManager.tree.physics_frame
|
||||||
static func until(predicate: Callable):
|
static func until(predicate: Callable):
|
||||||
var obj = predicate.get_object()
|
while is_instance_valid(predicate.get_object()):
|
||||||
while is_instance_valid(obj):
|
|
||||||
if predicate.call():
|
if predicate.call():
|
||||||
break
|
break
|
||||||
await frame()
|
await frame()
|
||||||
|
|||||||
Reference in New Issue
Block a user