小编Kev*_*ens的帖子

如何在Swift中继承NSOperation以将SKAction对象排队以进行串行执行?

Rob为子类化NSOperation 提供了一个很好的Objective-C解决方案,以实现SKAction对象的串行排队机制.我在自己的Swift项目中成功实现了这一点.

import SpriteKit

class ActionOperation : NSOperation
{
    let _node: SKNode // The sprite node on which an action is to be performed
    let _action: SKAction // The action to perform on the sprite node
    var _finished = false // Our read-write mirror of the super's read-only finished property
    var _executing = false // Our read-write mirror of the super's read-only executing property

    /// Override read-only superclass property as read-write.
    override var executing: Bool {
        get …
Run Code Online (Sandbox Code Playgroud)

nsoperation sprite-kit swift

5
推荐指数
1
解决办法
3660
查看次数

标签 统计

nsoperation ×1

sprite-kit ×1

swift ×1