public static void PackParty(this PokemonUnity.Monster.Pokemon[] Party) { PokemonUnity.Monster.Pokemon[] packedArray = new PokemonUnity.Monster.Pokemon[Party.Length]; int i2 = 0; //counter for packed array for (int i = 0; i < Party.Length; i++) { if (Party[i].IsNotNullOrNone()) // != null || Party[i].Species != Pokemons.NONE) { //if next object in box has a value packedArray[i2] = Party[i]; //add to packed array i2 += 1; //ready packed array's next position } } for (int i = 0; i < Party.Length; i++) { Party[i] = packedArray[i]; } }
public static bool IsNotNullOrNone(this PokemonUnity.Monster.Pokemon pokemon) { return(pokemon != null && pokemon.Species != Pokemons.NONE); }