Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
 private void OnOrphansFound(OrphanedBallsEventArgs e)
 {
     _scoreKeeper.ScoreOrphans(e.OrphanedBalls);
 }
Ejemplo n.º 3
0
 private void OnOrphansFound(OrphanedBallsEventArgs e)
 {
     BallsOrphaned += e.OrphanedBalls.Count;
 }