// Update is called once per frame void Update() { //Open Hands //drop in slot or on the ground if (Input.GetButtonUp("LeftHand") && IsHandFull("LeftHand")) { GameObject item = LeftHand.transform.GetChild(0).gameObject; if (currentTargetedSlot == null || currentTargetedSlot.itemInSlot != null) { Debug.Log("you have released what was in your left hand"); item.GetComponent <Rigidbody>().useGravity = true; item.GetComponent <Rigidbody>().isKinematic = false; item.transform.SetParent(null); item.GetComponent <Pint>().DestroyIn(3f, false); } else { currentTargetedSlot.AddDrinkInSlot(item); } } //drop in slot or on the ground if (Input.GetButtonUp("RightHand") && IsHandFull("RightHand")) { GameObject item = RightHand.transform.GetChild(0).gameObject; if (currentTargetedSlot == null || currentTargetedSlot.itemInSlot != null) { Debug.Log("you have released what was in your RightHand"); item.GetComponent <Rigidbody>().useGravity = true; item.GetComponent <Rigidbody>().isKinematic = false; item.transform.SetParent(null); item.GetComponent <Pint>().DestroyIn(3f, false); } else { currentTargetedSlot.AddDrinkInSlot(item); } } if ((Input.GetButtonUp("RightHand") || Input.GetButtonUp("LeftHand")) && isUsingPump) { isUsingPump = false; GetComponent <PlayerMovement>().enabled = true; } //Close Hands if (Input.GetButtonDown("LeftHand") && !IsHandFull("LeftHand")) { //take in stockpile if (null != actionZone && actionZone.GetComponent <Stockpile>()) { TakeInHand(LeftHand, actionZone.GetComponent <Stockpile>().GetItem()); } //take from a slot if (null != currentTargetedSlot && null != currentTargetedSlot.itemInSlot) { TakeInHand(LeftHand, currentTargetedSlot.itemInSlot); currentTargetedSlot.Take(); } } if (Input.GetButton("LeftHand") && !IsHandFull("LeftHand")) { //use pump if (null != actionZone && actionZone.GetComponent <Pump>()) { isUsingPump = true; GetComponent <PlayerMovement>().enabled = false; if (IsHandFull("RightHand")) { actionZone.GetComponent <Pump>().Fill(RightHand.transform.GetChild(0).GetComponent <Pint>()); } } } if (Input.GetButtonDown("RightHand") && !IsHandFull("RightHand")) { //take in stockpile if (null != actionZone && actionZone.GetComponent <Stockpile>()) { TakeInHand(RightHand, actionZone.GetComponent <Stockpile>().GetItem()); } //take on a slot if (null != currentTargetedSlot && null != currentTargetedSlot.itemInSlot) { TakeInHand(RightHand, currentTargetedSlot.itemInSlot); currentTargetedSlot.Take(); } } if (Input.GetButton("RightHand") && !IsHandFull("RightHand")) { //use pump if (null != actionZone && actionZone.GetComponent <Pump>()) { isUsingPump = true; GetComponent <PlayerMovement>().enabled = false; if (IsHandFull("LeftHand")) { actionZone.GetComponent <Pump>().Fill(LeftHand.transform.GetChild(0).GetComponent <Pint>()); } } } }