private void SetPokemon(Emplacement emplacement, EmplacementPokemon pokemon) { int position = (int)emplacement; int indexPokemon = -1; EmplacementPokemon tempPokemonEquipe = pokemon; tempPokemonEquipe.Ordre = emplacement; if (tempPokemonEquipe.Equipe) { indexPokemon = ChercherIndexDePokemonAchete(pokemon.Pokemon.IdPokemonAchete); tempPokemonEquipe.Pokemon.Emplacement = emplacement; } IndexPokemonsEquipes[position] = indexPokemon; if (Emplacements.Count == 3) { Emplacements.RemoveAt(position); Emplacements.Insert(position, tempPokemonEquipe); } else { Emplacements.Add(pokemon); } }
public void Echanger(Emplacement emplacement1, Emplacement emplacement2) { int position1 = (int)emplacement1; int position2 = (int)emplacement2; if (emplacement1 != emplacement2) { EmplacementPokemon pokemon1 = Emplacements[position1]; Emplacements[position1] = Emplacements[position2]; Emplacements[position2] = pokemon1; SetPokemon(emplacement1, Emplacements[position1]); SetPokemon(emplacement2, Emplacements[position2]); } }
public void RechargerEmplacements() { for (int i = 0; i < 3; i++) { Emplacement emplacement = (Emplacement)i; if (!Equipe(emplacement)) { SetPokemon(emplacement, new EmplacementPokemon(emplacement)); } else { int indexPokemonEquipe = IndexPokemonsEquipes[i]; Pokemon pokemon = PokemonsAchetes[indexPokemonEquipe]; EmplacementPokemon pokemonEquipe = new EmplacementPokemon(emplacement); pokemonEquipe.Pokemon = pokemon; SetPokemon(emplacement, pokemonEquipe); } } }