40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace Programmation_objet_TLESIO21.projet {
|
|||
|
public class Character {
|
|||
|
private string Name;
|
|||
|
private string Description;
|
|||
|
private int level;
|
|||
|
private List<Pokemon> PC;
|
|||
|
|
|||
|
#pragma warning disable CS8618 // Un champ non-nullable doit contenir une valeur non-null lors de la fermeture du constructeur. Envisagez de déclarer le champ comme nullable.
|
|||
|
public Character(string Name, string Description, List<Pokemon> PC) {
|
|||
|
this.Name = Name;
|
|||
|
this.Description = Description;
|
|||
|
this.PC = PC;
|
|||
|
this.level = PC.Count;
|
|||
|
}
|
|||
|
|
|||
|
public override string ToString() {
|
|||
|
String sb = this.Name + " est level " + this.level + "." + " " + this.Description + ". Ses pokemon sont :\n";
|
|||
|
foreach (Pokemon p in this.PC) {
|
|||
|
sb += p.getName() + ". ";
|
|||
|
}
|
|||
|
|
|||
|
return sb + "\n";
|
|||
|
}
|
|||
|
|
|||
|
public String getName() {
|
|||
|
return this.Name;
|
|||
|
}
|
|||
|
|
|||
|
public List<Pokemon> getPC() {
|
|||
|
return this.PC;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|