//// TODO: replace this function by creating a delegate in the entity that //// the factory methods will set to return the entity to the correct pool. public void ReturnToPool(Entity entityToReturn) { if (entityToReturn is Asteroid) { asteroidPool.Return(entityToReturn); } else if (entityToReturn is Laser) { laserPool.Return(entityToReturn); } else if (entityToReturn is Planet) { planetPool.Return(entityToReturn); } else if (entityToReturn is Ship) { shipPool.Return(entityToReturn); } }