Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何在SpriteKit中停止/删除序列?_Ios_Swift_Sprite Kit - Fatal编程技术网

Ios 如何在SpriteKit中停止/删除序列?

Ios 如何在SpriteKit中停止/删除序列?,ios,swift,sprite-kit,Ios,Swift,Sprite Kit,我正在使用SpriteKit的PlaySoundFileName按顺序播放一系列声音片段。问题是当我退出播放状态时会停止。与SKAudioNode不同,我无法命名和列举它们。因为声音剪辑是SKActions,我可以运行它们并分配一个键,然后分别停止它们,但是当我将它们添加到序列中时,如下图所示,当状态退出时声音不会停止。如何停止序列 class PlayingState: GKState { unowned let scene: GameScene var kQuot

我正在使用SpriteKit的
PlaySoundFileName
按顺序播放一系列声音片段。问题是当我退出
播放状态时
会停止。与SKAudioNode不同,我无法命名和列举它们。因为声音剪辑是
SKAction
s,我可以运行它们并分配一个键,然后分别停止它们,但是当我将它们添加到
序列中时,如下图所示,当状态退出时声音不会停止。如何停止
序列

class PlayingState: GKState {


    unowned let scene: GameScene  

     var kQuoteNum = 6


    init(scene: SKScene) {
        self.scene = scene as! GameScene
        super.init()
    }

    override func didEnterWithPreviousState(previousState: GKState?) {


        //Build array of quotes from resources folder
        var quoteArray = [SKAction]()

        for i in 0..<kQuoteNum {
            quoteArray.append(SKAction.playSoundFileNamed("quote\(i).wav", waitForCompletion: true))

            }



        //Sound
        scene.runAction(SKAction.sequence(quoteArray), withKey: "playQuotes")


    }

    override func willExitWithNextState(nextState: GKState) {
        scene.removeActionForKey("playQuotes")
    }
}
类播放状态:GKState{
无主出租场景:游戏场景
var kQuoteNum=6
初始化(场景:SKScene){
self.scene=场景为!游戏场景
super.init()
}
覆盖func DiEnterWithPreviousState(previousState:GKState?){
//从资源文件夹生成引号数组
var quotarray=[SKAction]()
因为我在0。。