Advertisement
i-Xuup

Arrojar pirata

Oct 11th, 2024
49
0
6 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | Gaming | 0 0
  1. else if (other.CompareTag("Pirate Collider") && isPirateCaptured)
  2. {
  3.     if (shortCollider.bounds.Intersects(other.bounds))
  4.     {
  5.         meanGuy.SetParent(null);
  6.         isPirateCaptured = false;
  7.         meanGuy.GetComponent<PirateController>().PirateSwimingFlee();
  8.     }
  9. }
  10.  
  11.  
  12. _____________________________________________________
  13.  
  14.  
  15. public void PirateSwimingFlee()
  16. {
  17.     anim.SetFloat("speed", 0f);
  18.     Vector3 direction = (link.startTransform.position - transform.position).normalized;
  19.     GetComponent<Rigidbody>().AddForce(direction * 500f);
  20.     link = null;
  21.     StartCoroutine(Swimming());
  22. }
  23.  
  24. IEnumerator Swimming()
  25. {
  26.     yield return new WaitForSeconds(1.5f);
  27.     anim.SetBool("Swimming", true);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement