Example #1
0
 /**
  * Assigns each user in the game to a role.
  */
 public function assignRoles()
 {
     $players = $this->roleStrategy->assign($this->lobbyPlayers, $this->optionsManager);
     foreach ($players as $player) {
         $this->livingPlayers[$player->getId()] = $player;
         $this->originalPlayers[$player->getId()] = $player;
     }
 }
Example #2
0
 /**
  * @param                       $id
  * @param \Slack\User[]         $users
  * @param RoleStrategyInterface $roleStrategy
  */
 public function __construct($id, array $users, RoleStrategyInterface $roleStrategy)
 {
     $this->id = $id;
     $players = $roleStrategy->assign($users);
     foreach ($players as $player) {
         $this->players[$player->getId()] = $player;
         $this->originalPlayers[$player->getId()] = $player;
     }
 }