コード例 #1
0
 private void Interact()
 {
     if (isPlayerOne)
     {
         if (Input.GetKeyDown(KeyCode.W))
         {
             if (pickUp.held_Object == null)
             {
                 source.clip = clip_Grab;
                 source.Play();
                 pickUp.GrabItem(rigid);
             }
             else
             {
                 source.clip = clip_Throw;
                 source.Play();
                 rigid.mass    = 0.0001f;
                 throwCounter += 1;
                 pickUp.ThrowItem(false);
             }
         }
     }
     else
     {
         if (Input.GetKeyDown(KeyCode.UpArrow))
         {
             if (pickUp.held_Object == null)
             {
                 source.clip = clip_Grab;
                 source.Play();
                 pickUp.GrabItem(rigid);
             }
             else
             {
                 source.clip = clip_Throw;
                 source.Play();
                 rigid.mass    = 0.0001f;
                 throwCounter += 1;
                 pickUp.ThrowItem(true);
             }
         }
     }
 }