private void OnOrphansFound(OrphanedBallsEventArgs e) { foreach (var ballController in e.OrphanedBalls) { var fallingBall = _simpleObjectPool.GetObjectFromPool(); fallingBall.transform.SetParent(BallContainer.transform); var orphanedBall = ballController.gameObject; var ballPosition = orphanedBall.GetComponent <Rigidbody2D>().position; fallingBall.GetComponent <Rigidbody2D>().position = ballPosition; fallingBall.GetComponent <Rigidbody2D>().AddForce(random.RandomVector(RandomForceMagnitude)); var ballSprite = ballController.CurrentBallSprite; fallingBall.GetComponent <SpriteRenderer>().sprite = ballSprite; } }
private void OnOrphansFound(OrphanedBallsEventArgs e) { _scoreKeeper.ScoreOrphans(e.OrphanedBalls); }
private void OnOrphansFound(OrphanedBallsEventArgs e) { BallsOrphaned += e.OrphanedBalls.Count; }