private void AddToPool(int i) { birdArray.get(i).setVisible(false); birdArray.get(i).setIgnoreUpdate(true); if (birdArray.get(i).currentType == BirdType.SIMPLE_BIG_RIGHT) { Log.w("GAME", "BIG_RIGHT to POOL"); bigRightBirdPool.recyclePoolItem(birdArray.get(i)); } else if (birdArray.get(i).currentType == BirdType.SIMPLE_BIG_LEFT) { Log.w("GAME", "BIG_LEFT to POOL"); bigLeftBirdPool.recyclePoolItem(birdArray.get(i)); } else if (birdArray.get(i).currentType == BirdType.SIMPLE_SMALL_RIGHT) { Log.w("GAME", "SMALL_RIGHT to POOL"); smallRightBirdPool.recyclePoolItem(birdArray.get(i)); } else if (birdArray.get(i).currentType == BirdType.SIMPLE_SMALL_LEFT) { Log.w("GAME", "SMALL_LEFT to POOL"); smallLeftBirdPool.recyclePoolItem(birdArray.get(i)); } birdArray.get(i).detachSelf(); birdArray.remove(birdArray.get(i)); }
/** this method is for handling static obstacle when recycle method called * */ @Override protected void onHandleRecycleItem(StaticObstacle obstacle) { super.onHandleRecycleItem(obstacle); obstacle.setVisible(false); obstacle.setIgnoreUpdate(true); }
private Bird GetNewtBird(GenericPool<Bird> pool, final float x, final float y, int duration) { final Bird bird = pool.obtainPoolItem(); bird.Init(x, y, duration); return bird; }