Exemplo n.º 1
0
 private function preparePlayers($sortedPlayers)
 {
     $this->load->model('weapon', '', true);
     $this->load->model('player', '', true);
     $players = array();
     foreach ($sortedPlayers as $p) {
         $weapon = new Weapon();
         $weapon->setData(['strike_force' => $p->strike_force, 'defense' => $p->defense, 'damage' => $p->damage]);
         $player = new Player();
         $player->setData(['name' => $p->player_name, 'health' => $p->health, 'strength' => $p->strength, 'agility' => $p->agility, 'weapon' => $weapon]);
         $players[] = $player;
     }
     return $players;
 }