private void OnDestroyAllBalls() { transform.position = new Vector3(PoolBalls.NextPosition(), transform.position.y, transform.position.z); countBalls++; countBallsOnCurrentShoot = countBalls; canShoot = true; }
private void InstantiateBall() { canShoot = false; timeNextShoot = Time.time + coolDown; countBallsOnCurrentShoot--; if (PoolBalls.CountInactive() == 0) { GameObject newBall = Instantiate(ball, transform.position, transform.rotation); PoolBalls.Add(newBall); } else { PoolBalls.ActiveNext(transform.position, transform.rotation); } }
private void DestroyBullet() { PoolBalls.Inactivate(gameObject); }