/// <summary> /// Cette Méthode permet de choisir le nom d'un animal par random dans la liste d'animaux de la bibliotheque. /// Le random choisi un index du tableau (de 0 à 8). /// </summary> /// <param name="tete"></param> /// <param name="corps"></param> public void RandomAnimal(Tete tete, Corps corps) { Bibliotheque liste = new Bibliotheque(); Random rand = new Random(); do { _indexPattes = rand.Next(liste.ListAnimaux.Count); } while (_indexPattes == tete.IndexTete || _indexPattes == corps.IndexCorps); _nomAnimal = liste.ListAnimaux[_indexPattes]; }
/// <summary> /// Constructeur de la Class Pattes /// </summary> /// <param name="tete">Récupère l'objet Tete</param> /// <param name="corps">Récupère l'objet Corps</param> public Pattes(Tete tete, Corps corps) { this.RandomAnimal(tete, corps); this.RécupererParticuleNom(); }