예제 #1
0
 //en caso de chocar y tener aun mas de 0 vidas restara en caso contrario se muere
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.tag == "Dead")
     {
         restLife();
         this.pointsR = this.pointsR - 200;
     }
     if (other.gameObject.tag == "Booster")
     {
         if (other.gameObject.name == "bota")
         {
             //no mucho que explicar ya estas comentados en su respectiva clase xd
             boosterScriptInstancia.boosterVelocity(2.0f, 3.0f, this.speed);
         }
         if (other.gameObject.name == "cruz")
         {
             //lo mismo solo que en este caso this.gameobject ser refiere a este objeto
             boosterScriptInstancia.boosterInvisible(4.0f, this.gameObject);
         }
         if (other.gameObject.name == "lodo")
         {
             obstaculeInstancia.nerfObstacule(1f, 1.0f, this.speed);
         }
         if (other.gameObject.name == "life")
         {
             addLife();
         }
     }
 }