bool getDestroyable(int index, bool hitBack) { int fromIndex; int toIndex; List <Ball> ballsToDestroy = GetBallsToDestroy(index, balls, out fromIndex, out toIndex); Ball ballDestroyNFrom = null; if (fromIndex - 1 >= 0) { ballDestroyNFrom = balls[fromIndex - 1]; } Ball ballDestroyNTo = null; if (toIndex + 1 < balls.Count) { ballDestroyNTo = balls[toIndex + 1]; } if (ballsToDestroy.Count >= 3) { EffectsPlayer.PlayEffect(ballsToDestroy); DestroyBalls(balls, ballsToDestroy, hitBack); fromIndex = balls.IndexOf(ballDestroyNFrom); toIndex = balls.IndexOf(ballDestroyNTo); if (ballDestroyNFrom != null && ballDestroyNTo != null) { if (ballDestroyNFrom.Type != ballDestroyNTo.Type) { SetBallsWait(fromIndex, toIndex, ballDestroyNTo); } else { SetBallsBack(fromIndex, ballDestroyNFrom); } } else { if (ballDestroyNTo == null && ballDestroyNFrom != null) { fromIndex = balls.IndexOf(ballDestroyNFrom); SetBallsBack(fromIndex, ballDestroyNFrom); } } return(true); } return(false); }