private void DetachInteractable()
 {
     heldItem.DetachController();
     heldItem = null;
     state    = MechHandState.Empty;
     IKGrab(false);
 }
 public void TakeFromActualHook(Interactable i)
 {
     heldItem = i;
     state    = MechHandState.Holding;
     i.SwitchController(this);
     IKGrab(true);
 }
 private void AttachInteractable()
 {
     heldItem = potentialHeld;
     heldItem.AttachController(this);
     potentialHeld = null;
     state         = MechHandState.Holding;
     IKGrab(true);
 }
 private void LaunchInteractable()
 {
     heldItem.DetachController();
     heldItem.gameObject.GetComponent <Rigidbody>().AddForce(transform.forward * throwForce, ForceMode.Impulse);
     heldItem = null;
     state    = MechHandState.Empty;
     IKGrab(false);
 }
 void OnTriggerExit(Collider other)
 {
     //Mech hand's collider includes the grappling hook's collider
     //and I don't know how to get it to stop so this'll have to do
     if (grapHookController.State == GrapplingHookState.Inactive)
     {
         if (other.gameObject.GetComponent <Interactable>())
         {
             state         = MechHandState.Empty;
             potentialHeld = null;
         }
     }
 }
 void Start()
 {
     sphereMat.SetColor("_EmissionColor", defaultColor);
     grapHookController = GetComponent <GrapplingHookController>();
     state = MechHandState.Empty;
     //IK setup stuff
     indexTarget  = transform.Find("TargetPoles").Find("IndexTarget");
     middleTarget = transform.Find("TargetPoles").Find("MiddleTarget");
     ringTarget   = transform.Find("TargetPoles").Find("RingTarget");
     littleTarget = transform.Find("TargetPoles").Find("LittleTarget");
     thumbTarget  = transform.Find("TargetPoles").Find("ThumbTarget");
     //Original positions
     indexOrig  = indexTarget.localPosition;
     middleOrig = middleTarget.localPosition;
     ringOrig   = ringTarget.localPosition;
     littleOrig = littleTarget.localPosition;
     thumbOrig  = thumbTarget.localPosition;
 }
    void OnTriggerEnter(Collider other)
    {
        colliding = true;


        //Mech hand's collider includes the grappling hook's collider
        //and I don't know how to get it to stop so this'll have to do
        if (grapHookController.State == GrapplingHookState.Inactive)
        {
            if (other.gameObject.GetComponent <Interactable>())
            {
                state         = MechHandState.InReach;
                potentialHeld = other.gameObject.GetComponent <Interactable>();
            }
        }

        //a winner is you
        if (other.gameObject.name == "WinRoom")
        {
            winText.text = "You reached the last room! \n            You Win!";
        }
    }
 public override void Detach()
 {
     heldItem = null;
     state    = MechHandState.Empty;
     IKGrab(false);
 }