1
我正在研究類似於this video tutorial中所述的以SpriteKit/Swift 2.2爲目標的iOS 9.3的類爆炸粒子系統。爲什麼工作粒子系統只有一次?
我(簡化)代碼:
let emiExplode = SKEmitterNode(fileNamed: "ExplosionParticleSystem.sks")
private func initEmitters() {
emiExplode?.particleBirthRate = 0.0
emiExplode?.targetNode = scene
emiExplode?.zPosition = 1
scene.addChild(emiExplode!)
}
private func explode() {
emiExplode?.position = self.position
emiExplode?.particleBirthRate = 2000.0
// remove explosion particle system shortly after
let action = SKAction.sequence([SKAction.waitForDuration(1.5),
SKAction.runBlock({ self.emiExplode?.particleBirthRate = 0 })])
emiExplode?.runAction(action)
}
我第一次打電話爆炸()它就像一個魅力。但第二次,粒子效應是不可見的...
任何想法?