【问题标题】:GKComponentSystem in Xcode 8 Swift 3Xcode 8 Swift 3 中的 GKComponentSystem
【发布时间】:2016-12-06 06:29:47
【问题描述】:

我在将项目转换为 Swift 3 时遇到问题。在以前版本的 Swift 中,我可以在 GKComponentSystem 下声明一个类,例如:

class EnemyMoveComponentSystem: GKComponentSystem {
}

但是在 swift 3 中,它迫使我在最后添加 :

class EnemyMoveComponentSystem: GKComponentSystem <GKComponent> {
    func updateWithDeltaTime(seconds: TimeInterval, gameScene: GameScene) {
        for component in components {
            print("something")
        }
    }
}

但我似乎无法像以前那样访问系统中的每个单独的组件

for component in components {
     print("something")   
}

print("something") 行从未被触发。 我怎样才能解决这个问题? 任何帮助表示赞赏!

【问题讨论】:

    标签: xcode swift3 gameplay-kit


    【解决方案1】:

    找出问题所在。我忘记将实体链接到组件系统。 .addComponent(foundIn: Entity)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-12-19
      • 1970-01-01
      • 2017-02-08
      • 2017-02-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多