更新时间:2023-02-01 13:00:17
AFAIK,您可以从 .sks
文件中获取 actions 字典.在这里,我有一个 MyCustomActions.sks
文件,其中包含一个操作 Pulse.
AFAIK, you can get the actions dictionary from the .sks
file. Here, I have a MyCustomActions.sks
file with an action Pulse.
guard
let node = SKNode(fileNamed: "MyCustomActions"),
let actions = node.value(forKey: "actions") as? [String:SKAction],
let pulse = actions["Pulse"]
else { return }
print(pulse.duration) // 0.6 seconds
从这里,您可以从 actions
字典中实现自己的 struct
.
From here, you can implement your own struct
from the actions
dictionary.
要获取所有操作的名称,
To get all the name of actions,
let actionNames = actions.map { $0.key } // ["Pulse"]