refillPool2 method
Implementation
void refillPool2(double percentage) {
int portionOfCapacity = (desiredCapacity * percentage).toInt();
if (portionOfCapacity < 1) {
portionOfCapacity = 1;
} else if (portionOfCapacity > desiredCapacity) {
portionOfCapacity = desiredCapacity;
}
for (int i = 0; i < portionOfCapacity; i++) {
this.objects[i] = modelObject.instantiate();
}
objectsPointer = portionOfCapacity - 1;
}