virtual protected void ActivateSwitch()
 {
     if (!isLeftPlugged && !isRightPlugged)
     {
         // Plug in
         if (Input.GetKeyDown(KeyCode.Q))
         {
             // Left hand ready to plug in
             // Right hand ready to plug out
             if (isLeftArmAround && leftArm.GetControl() ||
                 isRightArmAround && rightArm.GetControl())
             {
                 OnActivation();
                 return;
             }
         }
         if (Input.GetKeyDown(KeyCode.R) && player.HasControl())
         {
             if (isLeftPlugged || isRightPlugged)
             {
                 OnDeactivation();
                 isLeftArmAround  = false;
                 isRightArmAround = false;
                 isPlugOutEnabled = true;
             }
         }
     }
     // Start plugging out
     if (Input.GetKey(KeyCode.Q) && isPlugOutEnabled)
     {
         // If left hand must come out
         if (isLeftPlugged && leftArm.GetControl())
         {
             if (counter++ > waitToPlugOut)
             {
                 OnDeactivation();
             }
         }
         // If right hand must come out
         if (isRightPlugged && rightArm.GetControl())
         {
             if (counter++ > waitToPlugOut)
             {
                 OnDeactivation();
             }
         }
     }
     // Plug out
     if (Input.GetKeyUp(KeyCode.Q))
     {
         counter = 0;
         if ((isLeftPlugged && leftArm.GetControl()) ||
             (isRightPlugged && rightArm.GetControl()))
         {
             isPlugOutEnabled = true;
         }
     }
 }
 private void ChangeControl()
 {
     if (Input.GetKeyDown(KeyCode.Tab) && state != State.charge)
     {
         if ((arms == 1 && enabledArms == 2) ||
             (arms == 0 && enabledArms == 1))
         {
             if (isControlling)
             {
                 if (!isLeftRetrieving)
                 {
                     isControlling = false;
                     firstArm.SetControl(true);
                 }
             }
             else if (firstArm.GetControl())
             {
                 isControlling = true;
                 firstArm.SetControl(false);
             }
         }
         else if (arms == 0)
         {
             if (isControlling)
             {
                 if (!isLeftRetrieving)
                 {
                     isControlling = false;
                     firstArm.SetControl(true);
                 }
             }
             else if (firstArm.GetControl())
             {
                 firstArm.SetControl(false);
                 secondArm.SetControl(true);
             }
             else
             {
                 isControlling = true;
                 secondArm.SetControl(false);
             }
         }
     }
 }
    protected void DisableControl()
    {
        bool playerControl   = player.HasControl();
        bool leftArmControl  = leftArm.GetControl();
        bool rightArmControl = rightArm.GetControl();

        if (playerControl)
        {
            controlIndex = 0;
            player.ResetPower();
        }
        else if (leftArmControl)
        {
            controlIndex = 1;
        }
        else if (rightArmControl)
        {
            controlIndex = 2;
        }

        player.SetControl(false);
        leftArm.SetControl(false);
        rightArm.SetControl(false);
    }
 private void ActivateSwitch()
 {
     if (Input.GetKeyDown(KeyCode.Q))
     {
         // If this switch is plugged in by eiher right or left
         if (isLeftPlugged || isRightPlugged)
         {
             // Activating switch
             if (!isActivated)
             {
                 // Activate only when the plugged hand is being controlled
                 if ((isLeftPlugged && leftHand.GetControl()) ||
                     (isRightPlugged && rightHand.GetControl()))
                 {
                     isActivated = true;
                     Invoke("Deactivate", 0.5f);
                 }
             }
         }
         else
         {
             // Plugging into switch
             if (isLeftHandAround && !isLeftPlugged && leftHand.GetControl())
             {
                 isLeftPlugged = true;
                 leftHand.OnPlugIn();
                 return;
             }
             if (isRightHandAround && !isRightPlugged && rightHand.GetControl())
             {
                 isRightPlugged = true;
                 rightHand.OnPlugIn();
                 return;
             }
         }
     }
     if (Input.GetKey(KeyCode.Q) && isPlugOutEnabled)
     {
         if (isLeftPlugged && leftHand.GetControl())
         {
             if (counter++ > waitToPlugOut)
             {
                 isLeftPlugged = false;
                 leftHand.OnPlugOut();
                 isPlugOutEnabled = false;
             }
         }
         if (isRightPlugged && rightHand.GetControl())
         {
             if (counter++ > waitToPlugOut)
             {
                 isRightPlugged = false;
                 rightHand.OnPlugOut();
                 isPlugOutEnabled = false;
             }
         }
     }
     if (Input.GetKeyUp(KeyCode.Q))
     {
         counter = 0;
         if ((isLeftPlugged && leftHand.GetControl()) || (isRightPlugged && rightHand.GetControl()))
         {
             isPlugOutEnabled = true;
         }
     }
 }