-
Notifications
You must be signed in to change notification settings - Fork 0
/
Equipe.cs
79 lines (70 loc) · 1.51 KB
/
Equipe.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
namespace MyNameIsGladiator
{
public class Equipe
{
private string _Nom;
public string NomEquipe
{
get { return this._Nom; }
set { this._Nom = value; }
}
private string _Description;
public string Description
{
get { return this._Description; }
set { this._Description = value; }
}
public Gladiateur[] _gladiateurs = new Gladiateur[3];
public Gladiateur[] gladiateurs
{
get {return _gladiateurs;}
set {_gladiateurs = value;}
}
public Equipe (string nom, string description)
{
this._Nom = nom;
this._Description = description;
}
public void CreerGladiateur(Gladiateur createGladiateur, int i)
{
gladiateurs[i] = createGladiateur;
}
public string AfficherGladiateur(int i)
{
return this.gladiateurs[i]._positionFile + "/" + this.gladiateurs[i].nomGladiateur;
}
public string AfficherEquipe()
{
return "l'équipe s'appelle " + this._Nom + ". Description: " + this._Description;
}
/* ON DETERMINE L'ORDRE DES GLADIATEURS */
public int DeterminerOrdreGlad()
{
int ordre = -1;
int i = 0;
foreach (Gladiateur gladiateur in gladiateurs)
{
if (gladiateur.Etat) {
ordre = i;
break;
} else {
i++;
}
}
return ordre;
}
/* RETOURNE VRAI SI AU MOINS UN GLADIATEUR EST VIVANT DANS L'EQUIPE */
public bool hasGladiateurOk()
{
bool result = false;
foreach (Gladiateur gladiater in gladiateurs) {
if (gladiater.Etat) {
result = true;
break;
}
}
return result;
}
}
}