Created
December 1, 2012 02:32
-
-
Save gilday/4180271 to your computer and use it in GitHub Desktop.
Tim: this is how i assigned characters to everyone playing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(ClueGameService*) initNewGameWithPlayers:(NSArray *)gkTurnBasedParticipants | |
{ | |
self = [super init]; | |
NSMutableArray *playersList = [[NSMutableArray alloc] initWithCapacity:[gkTurnBasedParticipants count]]; | |
// The first player is always ms scarlet. don't care about the rest | |
NSArray *allCharacters = [[NSArray alloc] initWithObjects:[ClueCharacterFactory msScarlet], [ClueCharacterFactory colMustard], [ClueCharacterFactory mrsWhite], [ClueCharacterFactory profPlum] , nil]; | |
for (int i = 0; i < [gkTurnBasedParticipants count]; i++) { | |
Player *player = [[Player alloc] init]; | |
player.participant = [gkTurnBasedParticipants objectAtIndex:i]; | |
player.character = [allCharacters objectAtIndex:i]; | |
player.location = [player.character name]; | |
[playersList addObject:player]; | |
} | |
players = playersList; | |
currentPlayer = [playersList objectAtIndex:0]; | |
return self; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment