Ejemplo n.º 1
0
 private void GrabObject(Rigidbody rigidbody)
 {
     mouseOffset               = Vector3.zero;
     rigidbodyHeld             = rigidbody;
     rigidbodyHeld.useGravity  = false;
     rigidbodyHeld.constraints = RigidbodyConstraints.FreezeRotationX |
                                 RigidbodyConstraints.FreezeRotationY |
                                 RigidbodyConstraints.FreezeRotationZ;
     holdState = HoldState.Moving;
     SoundUtils.PlaySoundNonrepeating(audioSource, grabSounds);
 }
Ejemplo n.º 2
0
 void OnCollisionEnter(Collision collision)
 {
     if (gameObject.tag == "Stuck")
     {
         return;
     }
     if (gameObject.tag == "Sticky" && collision.collider.tag == "Stuck")
     {
         gameObject.tag = "Stuck";
         GameObject       player     = GameObject.FindWithTag("Player");
         PlayerController controller = player.GetComponent <PlayerController>();
         controller.LetGoOfObject();
         SoundUtils.PlaySoundNonrepeating(audioSource, placeSounds);
     }
 }