Adefinir  1
Employes.php
Go to the documentation of this file.
1 <?php
8 namespace App\Models;
9 
10 use App\Models\Game;
17 
18 
19 
24 class Employes {
25 
26 
27  private Game $_game;
28 
39 
44  private int $_NB_MAX_EMPLOYEES = 10;
45 
51  private int $_nbEmployees = 0;
52 
53  // =======================================================
54 
58  public function __construct( Game $game ) {
59  $this->_developpeur = new Developpeur($this);
60  $this->_dirMarketing = new DirecteurMarketing($this);
61  $this->_gameDesigner = new GameDesigner($this);
62  $this->_psy = new Psychologue($this);
63  $this->_soundDesigner = new SoundDesigner($this);
64  $this->_specialiste = new Specialiste($this);
65 
66  $this->_game = $game;
67  }
68 
69  // =======================================================
70 
80  public function hireEmployees( string $nameJob ) : int {
81  $res = -1;
82 
83  if ( $this->_nbEmployees < $this->_NB_MAX_EMPLOYEES ) {
84  // Le joueur peut embaucher un employé
85 
86  $this->_nbEmployees += 1;
87 
88  switch ($nameJob) {
89  case "Developpeur":
90  $res = $this->_developpeur->hireDeveloper();
91  if(isset($_SESSION['logs']))
92  {
93  $log = $_SESSION['logs'];
94  }
95  else
96  {
97  $log = array();
98  }
99  array_push('Vous avez embauché un nouveau développeur',$log);
100  $_SESSION['logs']=$log;
101  break;
102 
103  case "DirecteurMarketing":
104  $res = $this->_dirMarketing->hireDirecteurMarketing();
105  break;
106 
107  case "GameDesigner":
108  $res = $this->_gameDesigner->hireGameDesigner();
109  break;
110 
111  case "Psychologue":
112  $res = $this->_psy->hirePsychologue();
113  break;
114 
115  case "SoundDesigner":
116  $res = $this->_soundDesigner->hireSoundDesigner();
117  break;
118 
119  case "Specialiste":
120  $res = $this->_specialiste->hireSpecialiste();
121  break;
122 
123  default: // Erreur
124  $res = -2;
125  $_SESSION["message"] = "ERREUR : bad job name in Employes->hireEmployees";
126  break;
127  }
128  }
129 
130  return $res;
131  }
132 
133 
142  public function fireEmployees( string $nameJob ) : int {
143  $res = -1;
144 
145  if ( $this->_nbEmployees > 0 ) {
146  // Le joueur peut licencier un employé
147 
148  $this->_nbEmployees = $this->_nbEmployees - 1;
149 
150  switch ($nameJob) {
151  case "Developpeur":
152  $res = $this->_developpeur->fireDeveloper();
153  break;
154 
155  case "DirecteurMarketing":
156  $res = $this->_dirMarketing->fireDirecteurMarketing();
157  break;
158 
159  case "GameDesigner":
160  $res = $this->_gameDesigner->fireGameDesigner();
161  break;
162 
163  case "Psychologue":
164  $res = $this->_psy->firePsychologue();
165  break;
166 
167  case "SoundDesigner":
168  $res = $this->_soundDesigner->fireSoundDesigner();
169  break;
170 
171  case "Specialiste":
172  $res = $this->_specialiste->fireSpecialiste();
173  break;
174 
175  default: // Erreur
176  $res = -2;
177  $_SESSION["message"] = "ERREUR : bad job name in Employes->hireEmployees";
178  break;
179  }
180  }
181 
182  return $res;
183  }
184 
185 
196  public function incrementActionResults( string $varName, int $increment ) : void {
197 
198  switch ($varName) {
199 
200  case "difficulty":
201  $this->_game->difficulty += $increment;
202  break;
203 
204  case "affordance":
205  $this->_game->affordance += $increment;
206  break;
207 
208  case "playability":
209  $this->_game->playability += $increment;
210  break;
211 
212  case "design":
213  $this->_game->design += $increment;
214  break;
215 
216  case "soundScape":
217  $this->_game->soundscape += $increment;
218  break;
219 
220  case "interactivity":
221  $this->_game->interactivity += $increment;
222  break;
223 
224  case "bugs":
225  $this->_game->bugs += $increment;
226  break;
227 
228  case "scenario":
229  $this->_game->scenario += $increment;
230  break;
231 
232  case "research":
233  $this->_game->research += $increment;
234  break;
235 
236  case "focus":
237  $this->_game->focus += $increment;
238  break;
239 
240  case "educationalContent":
241  $this->_game->educationalContent += $increment;
242  break;
243 
244  default:
245  /* Rien */
246  break;
247  }
248 
249  }
250 
251 
252 }
App\Models\Metiers\GameDesigner
Definition: GameDesigner.php:6
App\Models\Employes
Definition: Employes.php:24
App\Models\Employes\$_psy
Psychologue $_psy
Definition: Employes.php:36
App\Models\Game
Definition: Game.php:10
App\Models\Metiers\Specialiste
Definition: Specialiste.php:6
App\Models\Employes\hireEmployees
hireEmployees(string $nameJob)
Definition: Employes.php:80
App\Models\Employes\incrementActionResults
incrementActionResults(string $varName, int $increment)
Definition: Employes.php:196
App\Models\Employes\__construct
__construct(Game $game)
Definition: Employes.php:58
App\Models\Metiers\DirecteurMarketing
Definition: DirecteurMarketing.php:16
App\Models\Metiers\Developpeur
Definition: Developpeur.php:10
App\Models\Employes\$_gameDesigner
GameDesigner $_gameDesigner
Definition: Employes.php:35
App\Models\Metiers\SoundDesigner
Definition: SoundDesigner.php:9
App\Models\Employes\$_specialiste
Specialiste $_specialiste
Definition: Employes.php:38
App\Models\Employes\fireEmployees
fireEmployees(string $nameJob)
Definition: Employes.php:142
App\Models
Definition: Chart.php:3
App\Models\Employes\$_developpeur
Developpeur $_developpeur
Definition: Employes.php:33
App\Models\Employes\$_dirMarketing
DirecteurMarketing $_dirMarketing
Definition: Employes.php:34
App\Models\Employes\$_soundDesigner
SoundDesigner $_soundDesigner
Definition: Employes.php:37
App\Models\Metiers\Psychologue
Definition: Psychologue.php:11