예제 #1
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.collider.CompareTag("Grappable"))
     {
         Rigidbody rb = collision.gameObject.GetComponent <Rigidbody>();
         if (rb != null)
         {
             if (cl != null && cl.getObjName() == name)
             {
                 rb.velocity = cl.getVelocity() * multiplicator;
             }
             else if (cr != null && cr.getObjName() == name)
             {
                 rb.velocity = cr.getVelocity() * multiplicator;
             }
         }
     }
 }
예제 #2
0
파일: PlugUnplug.cs 프로젝트: Xwilarg/jpo
 private void OnTriggerEnter(Collider other)
 {
     if (counterTake > 0f)
     {
         return;
     }
     for (int i = 0; i < allName.Length; i++)
     {
         if (allName[i] == other.name)
         {
             if (!startOut)
             {
                 startOut = true;
                 return;
             }
             if (cl != null && cl.getObjName() == name)
             {
                 cl.drop();
             }
             if (cr != null && cr.getObjName() == name)
             {
                 cr.drop();
             }
             transform.rotation = other.transform.rotation * Quaternion.Euler(allRot[i]);
             transform.parent   = other.transform;
             transform.position = other.transform.position + allPos[i];
             if (name == "UsbKey")
             {
                 Destroy(GetComponent <Rigidbody>());
             }
             else
             {
                 rb.isKinematic = true;
             }
             break;
         }
     }
 }