Ejemplo n.º 1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (bouncing && numberOfBounces > 0 && collision.gameObject.tag == "Wall")
     {
         //Debug.Log("Bounce");
         brain.SetDirection(new Vector2(brain.GetDirection().x * -1, 0));
         numberOfBounces--;
         if (numberOfBounces <= 0)
         {
             bouncing = false;
         }
     }
 }
Ejemplo n.º 2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     //print("Bounce me!");
     if (bouncing && numberOfBounces > 0 && collision.gameObject.tag == "Wall")
     {
         Debug.Log("Bounce");
         brain.SetDirection(new Vector2(brain.GetDirection().x * -1, 0));
         numberOfBounces--;
         if (numberOfBounces <= 0)
         {
             bouncing = false;
         }
         boatLightLerper.SetFacingLeft(!boatLightLerper.GetFacingLeft());
     }
 }