Exemple #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (tag == "Life Up" && collision.gameObject.GetComponent <Paddle>())
     {
         lives.AddHeartContainer();
     }
     if (tag == "Life Down" && collision.gameObject.GetComponent <Paddle>())
     {
         gameController.DecreaseLives();
         lives.RemoveHeartContainer();
     }
     if (tag == "Extra Ball" && collision.gameObject.GetComponent <Paddle>())
     {
         gameController.AddExtraBall();
     }
     if (tag == "Snowflake" && collision.gameObject.GetComponent <Paddle>())
     {
         paddle.StopMovement();
     }
     if (tag == "Paddle Grow" && collision.gameObject.GetComponent <Paddle>())
     {
         gameController.ChangeToLargePaddle();
     }
     if (tag == "Paddle Shrink" && collision.gameObject.GetComponent <Paddle>())
     {
         gameController.ChangeToSmallPaddle();
     }
     if (tag == "Faster Ball" && collision.gameObject.GetComponent <Paddle>())
     {
         gameController.MoveBallsFaster();
     }
     if (tag == "Slower Ball" && collision.gameObject.GetComponent <Paddle>())
     {
         gameController.MoveBallsSlower();
     }
     Destroy(gameObject);
 }