2015-06-05 91 views
0

我需要匹配3個玩家,1個嚮導和2個戰士作爲屬性。 GKMatch如何做到這一點?下面的代碼片斷是從我的代碼Gamecenter配對

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

您可以定義3個角色?如:

case wizard = 0xffff0000 
case warrior1 = 0x0000ff00 
case warrior2 = 0x000000ff 

您將需要(「紅」戰士「藍」戰士)兩個戰士類型之間的一些輕微的差異,也可能隨機分配TYPE1或TYPE2給每個戰士玩家。

+0

感謝您的回覆,但這不適用於我的情況,因爲遊戲中的兩名戰士都是完全平等的。 – mjeragh

0

我想通了這個問題。解決的方法是將戰士設置爲0xfffffff