我需要匹配3名玩家,1名巫师和2名战士作为属性。如何用GKMatch完成?以下代码段来自我的代码
var wizard = true
enum Role : UInt32 {
case wizard = 0xffff0000
case warrior = 0x0000ffff
}
let matchRequest = GKMatchRequest()
matchRequest.minPlayers = 3
matchRequest.maxPlayers = 3
matchRequest.playerAttributes = wizard ? Role.wizard.rawValue : Role.warrior.rawValue
let matchMakerViewController = GKMatchmakerViewController(matchRequest: matchRequest)
matchMakerViewController.matchmakerDelegate = self
presentingViewController?.presentViewController(matchMakerViewController, animated: false, completion:nil)
为两个玩家设置一切,1个向导和1个战士,工作正常但我需要2个战士才能进行比赛。
提前谢谢
答案 0 :(得分:0)
你能定义3个角色吗?如:
case wizard = 0xffff0000
case warrior1 = 0x0000ff00
case warrior2 = 0x000000ff
你需要在两个战士类型(“红色”战士和“蓝色”战士)之间略微区分,或者可以随机地为每个战士玩家分配type1或type2。
答案 1 :(得分:0)
我弄明白了这个问题。解决方案是将warrior设置为0xfffffff