このようなものに相当する SpriteKit は何ですか?
[CCNode schedule:@selector(doActivate)
interval:[[enemyData objectForKey:@"spawnTime"] floatValue]];
このようなものに相当する SpriteKit は何ですか?
[CCNode schedule:@selector(doActivate)
interval:[[enemyData objectForKey:@"spawnTime"] floatValue]];
これを行うには、SKAction を使用できます。
+ (SKAction *)performSelector:(SEL)selector onTarget:(id)target or
+ (SKAction *)runBlock:(dispatch_block_t)block queue:(dispatch_queue_t)queue
と組み合わせ:
+ (SKAction *)repeatActionForever:(SKAction *)action
と
+ (SKAction *)waitForDuration:(NSTimeInterval)sec
各呼び出し間の遅延
Cocos のスケジューラー:
[self schedule:@selector(doActivate:)
interval:[[enemyData objectForKey:@"spawnTime"] floatValue]];
SKAction を使用した Spritekit と同等:
SKAction *wait = [SKAction waitForDuration:[[enemyData objectForKey:@"spawnTime"] floatValue]];
SKAction *performSelector = [SKAction performSelector:@selector(doActivate:) onTarget:self];
SKAction *sequence = [SKAction sequence:@[performSelector, wait]];
SKAction *repeat = [SKAction repeatActionForever:sequence];
[self runAction:repeat];