Exemplo n.º 1
0
 void OnTriggerEnter2D(Collider2D coll)
 {
     if (coll.gameObject.name.Equals ("BottomBorder")) {
         Destroy (gameObject);
         return;
     }
     if (coll.gameObject.tag.Equals ("Player")) {
         switch(powerName){
             case "Lengthen":
                 PaddleController paddle = coll.gameObject.GetComponent<PaddleController>();
                 paddle.StartCoroutine (paddle.LengthPowerUp (seconds));
                 break;
             case "Clone Ball":
                 ball = GameObject.FindGameObjectWithTag ("Ball").GetComponent<BallController>();
                 if(ball != null){
                     ball.CloneBall ();
                 }
                 break;
             case "Annihilator":
                 ball = GameObject.FindGameObjectWithTag ("Ball").GetComponent<BallController>();
                 if(ball != null){
                     ball.StartCoroutine (ball.Annihilator (seconds));
                 }
                 break;
             case "Extra Life":
                 GameObject.FindGameObjectWithTag ("Lives").GetComponent<LifeTracker>().GainLife ();
                 break;
         }
         Destroy(gameObject);
     }
 }