Exemplo n.º 1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if ((occupied && other.tag != "Croquette") || other.tag == "Champi" || other.tag == "TrapGround")
     {
         return;
     }
     if (other.tag == "Player")
     {
         StartCoroutine(stopControl(other, stopControlTime));
         if (!canBoostJump)
         {
             StartCoroutine(camScript.FreezeCameraOnPlayerTillGrounded());
         }
     }
     RB = other.GetComponent <Rigidbody2D> ();
     if (angle != 0)
     {
         RB.transform.position = jumpTrsf.position;
         RB.AddForce(new Vector2(-sin, cos) * forceRebond);
         RB.velocity = new Vector2(0, 0);
     }
     else
     {
         RB.velocity = new Vector2(Mathf.Abs(cos) * RB.velocity.x, Mathf.Abs(sin) * RB.velocity.y);
         RB.AddForce(new Vector2(-sin, cos) * forceRebond);
     }
     source.Play();
     if (unchangedSound == false)
     {
         StartCoroutine(soundChange());
     }
 }