public bool AddPokemon(Pokemon pokemon) { if (!CanAddPokemon()) { return(false); } var slot = new PokeSlot(this, pokemon); GetSlots().Add(slot); if (selectedIndex == -1) { GetPokeSlot(slot.index); //Select by default if no pokemon is selectedIndex } return(true); }
public void Swap(int index1, int index2) { var slots = GetSlots(); if (System.Diagnostics.Debugger.IsAttached) { if ((index1 < 0 || index1 >= SlotCount()) || (index2 < 0 || index2 >= SlotCount())) { throw new Exception("Error: A PokeParty swap index is invalid."); } } PokeSlot slot = slots[index1]; slots[index1] = slots[index2]; slots[index2] = slot; }