-(void)handleContact:(SKPhysicsContact*)contact{
NSArray *nodeNames = @[contact.bodyA.node.name, contact.bodyB.node.name];
if ([nodeName containsObject:player] && [nodeName containsObject:window] { //player and windows are defined strings which are set in SKSpriteNode names
Do something to window
} else if ([nodeName containsObject:player] && [nodeName containsObject:door])
Do something to door
} //Continue another 10 times with different defined strings except player
}
这种代码是否适合碰撞检测,还是有更好的方法可以解决这个问题?