예제 #1
0
 private void GrabObject(GameObject objectToGrab)
 {
     if (!objectToGrab.GetComponent <Rigidbody>())
     {
         Debug.Log("Not grabbing object " + objectToGrab + " with " + gameObject + " as it has no RidgidBody component");
         return;
     }
     else if (ConnectionJoint.connectedBody)
     {
         Debug.Log("Not grabbing object " + objectToGrab + " with " + gameObject + " as we already have grabbed " + ConnectionJoint.connectedBody.gameObject);
         return;
     }
     else
     {
         Debug.Log("Grabbing object " + objectToGrab + " with " + gameObject);
         ConnectionJoint.connectedBody = objectToGrab.GetComponent <Rigidbody>();
         if (Next)
         {
             Debug.Log(gameObject + " is activating the next object CUBPart");
             Next.Activate(gameObject);
         }
     }
 }