public override void TwoHandedContextualAction(ObjectInHand _objectInOtherHand) { //all right handed actions Debug.Log("Rotating glass!"); if (this.tag == "RightHand") { if (_objectInOtherHand == ObjectInHand.Bottle) { transform.DOLocalMove(posRightHandedAction, 0.75f, false); } //Rag else if (_objectInOtherHand == ObjectInHand.Rag) { RightHandToRagTween(); } } //all left-handed actions else if (this.tag == "LeftHand") { //Bottle if (_objectInOtherHand == ObjectInHand.Bottle) { transform.DOLocalMove(posLeftHandedAction, 0.75f, false); } // transform.DOLocalRotate(myLeftHandedPourRotation, 0.75f, RotateMode.Fast); //Rag else if (_objectInOtherHand == ObjectInHand.Rag) { LeftHandToRagTween(); } } }
void Start() { money = 0f; objectInHand = new ObjectInHand { gameObject = null }; }
public virtual void TwoHandedContextualAction(ObjectInHand _objectInOtherHand) { // if(_objectInOtherHand == ObjectInHand.Bottle){ // //do left handed animation // transform.DOLocalRotate(myLeftHandedPourRotation, 0.75f, RotateMode.Fast); // } else if (_objectInOtherHand.tag == "LeftHand") { // //Do right-handed animation // transform.DOLocalRotate(myRightHandedPourRotation, 0.75f, RotateMode.Fast); // } }
void Update() { if (m_pickable != null) { m_objectTimer -= Time.deltaTime; if (Input.GetButtonDown("InteractPlayer" + gameObject.GetComponent <Player>().playerNumber) && m_objectTimer <= 0.0f) { m_pickable.GetComponent <Transform>().SetParent(null); m_pickable.AddComponent <Rigidbody>(); m_pickable.GetComponent <Rigidbody>().mass = 100; m_objectInHand = ObjectInHand.None; m_pickable = null; } } }
public override void TwoHandedContextualAction(ObjectInHand _objectInOtherHand) { //all right handed actions if (this.tag == "RightHand") { if (_objectInOtherHand == ObjectInHand.Glass) { RightRagToGlassTween(); } } //all left-handed actions else if (this.tag == "LeftHand") { if (_objectInOtherHand == ObjectInHand.Glass) { LeftRagToGlassTween(); } } }
private void DropObject(KeyCode key) { //check which hand to drop object from if (key == leftHandPickUpKey) { if (objectInLeftHandGO != null && !objectInLeftHandGO.GetComponent <Interactable>().tweensAreActive) { objectInLeftHandGO.tag = "Untagged"; if (!lookingAtCoaster) { objectInLeftHandGO.GetComponent <Interactable>().TweenToTable(Services.Dropzone_Manager.nearest.transform.position); } else if (lookingAtCoaster && coasterInRangeAndLookedAt.GetComponent <SnapTriggerArea>().snapState == SnapTriggerArea.SnapTriggerAreaState.INTERACTABLE_IS_OUT) { objectInLeftHandGO.GetComponent <Interactable>().TweenToTable(coasterInRangeAndLookedAt.transform.position); } objectInLeftHandGO.transform.SetParent(null); objectInLeftHandGO = null; leftHandIsFree = true; objectInLeftHand = ObjectInHand.None; } } else if (key == rightHandPickUpKey) { if (objectInRightHandGO != null && !objectInRightHandGO.GetComponent <Interactable>().tweensAreActive) { objectInRightHandGO.tag = "Untagged"; if (!lookingAtCoaster) { objectInRightHandGO.GetComponent <Interactable>().TweenToTable(Services.Dropzone_Manager.nearest.transform.position); } else if (lookingAtCoaster && coasterInRangeAndLookedAt.GetComponent <SnapTriggerArea>().snapState == SnapTriggerArea.SnapTriggerAreaState.INTERACTABLE_IS_OUT) { objectInRightHandGO.GetComponent <Interactable>().TweenToTable(coasterInRangeAndLookedAt.transform.position); } objectInRightHandGO.transform.SetParent(null); objectInRightHandGO = null; rightHandIsFree = true; objectInRightHand = ObjectInHand.None; } } }
public override void TwoHandedContextualAction(ObjectInHand _objectInOtherHand) { //all right handed actions if (this.tag == "RightHand") { if (_objectInOtherHand == ObjectInHand.Glass) { transform.DOLocalRotate(rotRightHandedAction, 0.75f, RotateMode.Fast); } transform.DOLocalMoveY(0, 0.75f, false); } //all left-handed actions else if (this.tag == "LeftHand") { if (_objectInOtherHand == ObjectInHand.Glass) { transform.DOLocalRotate(rotLeftHandedAction, 0.75f, RotateMode.Fast); } transform.DOLocalMoveY(0, 0.75f, false); } }
private void PickUpInteractableWithRightHand(Interactable _interactable) { _interactable.TweenToHand(rightHandPos); _interactable.tag = "RightHand"; if (_interactable.gameObject.GetComponent <Base>() != null || _interactable.gameObject.GetComponent <Mixer>() != null) { //then it's a bottle objectInRightHand = ObjectInHand.Bottle; } else if (_interactable.gameObject.GetComponent <Glass>() != null) { objectInRightHand = ObjectInHand.Glass; } else if (_interactable.gameObject.GetComponent <Rag>() != null) { objectInRightHand = ObjectInHand.Rag; } rightHandIsFree = false; objectInRightHandGO = interactableCurrentlyInRangeAndLookedAt; // objectsInHand.Push(interactableCurrentlyInRangeAndLookedAt); }
private void SwapInteractableInRightHand(Interactable _interactable) { // _interactable.DisableCollider(); _interactable.TweenToHand(rightHandPos); _interactable.tag = "RightHand"; Debug.Log("Tweening to right hand!"); if (objectInRightHandGO != null && !objectInRightHandGO.GetComponent <Interactable>().tweensAreActive) { objectInRightHandGO.tag = "Untagged"; if (!lookingAtCoaster) { objectInRightHandGO.GetComponent <Interactable>().TweenToTable(Services.Dropzone_Manager.nearest.transform.position); } else if (lookingAtCoaster && coasterInRangeAndLookedAt.GetComponent <SnapTriggerArea>().snapState == SnapTriggerArea.SnapTriggerAreaState.INTERACTABLE_HASBEEN_POSITIONED) { objectInRightHandGO.GetComponent <Interactable>().TweenToTable(coasterInRangeAndLookedAt.transform.position); Debug.Log("Tweening to table from right hand!"); } // objectInRightHandGO.GetComponent<Interactable>().TweenToTable(Services.Dropzone_Manager.nearest.transform.position); objectInRightHandGO.transform.SetParent(null); objectInRightHandGO = null; objectInRightHandGO = _interactable.gameObject; if (_interactable.gameObject.GetComponent <Base>() != null || _interactable.gameObject.GetComponent <Mixer>() != null) { //then it's a bottle objectInRightHand = ObjectInHand.Bottle; } else if (_interactable.gameObject.GetComponent <Glass>() != null) { objectInRightHand = ObjectInHand.Glass; } else if (_interactable.gameObject.GetComponent <Rag>() != null) { objectInRightHand = ObjectInHand.Rag; } } }
protected override Response AsyncTask(Command command) { TextBoxStreamWriter.DefaultLog.WriteLine("Cmd RaCloseGrip: Received: " + command.StringToSend); bool success = false; bool ObjectInHand; Response response; double force; if (command.HasParams) { if (this.taskPlanner.MovingRightArm) { TextBoxStreamWriter.DefaultLog.WriteLine("Cmd RaCloseGrip: Right Arm is busy executing another command"); response = Response.CreateFromCommand(command, false); TextBoxStreamWriter.DefaultLog.WriteLine("Cmd RaCloseGrip: Sent response: " + response.StringToSend); return(response); } if (!double.TryParse(command.Parameters, out force)) { TextBoxStreamWriter.DefaultLog.WriteLine("Cmd RaCloseGrip: Can't parse parameters"); response = Response.CreateFromCommand(command, false); TextBoxStreamWriter.DefaultLog.WriteLine("Cmd RaCloseGrip: Sent response: " + response.StringToSend); return(response); } // antes de hand success = this.taskPlanner.RaCloseGripper(force, out ObjectInHand); //if (!this.taskPlanner.UseRaHand) // success = this.taskPlanner.RaCloseGripper(force, out ObjectInHand); //else //{ // success = this.taskPlanner.RaHand(0, 0, 0, 0); // ObjectInHand = true; //Hard code //} if (!this.taskPlanner.MovingLeftArm) { this.CommandManager.Busy = false; } command.Parameters = ObjectInHand.ToString(); response = Response.CreateFromCommand(command, success); TextBoxStreamWriter.DefaultLog.WriteLine("Cmd RaCloseGrip: Sent response: " + response.StringToSend); return(response); } else { if (this.taskPlanner.MovingRightArm) { TextBoxStreamWriter.DefaultLog.WriteLine("Cmd RaCloseGrip: Right Arm is busy executing another command"); response = Response.CreateFromCommand(command, false); TextBoxStreamWriter.DefaultLog.WriteLine("Cmd RaCloseGrip: Sent response: " + response.StringToSend); return(response); } double defaultforce; if (this.taskPlanner.UseRaHand) { defaultforce = 80; } else { defaultforce = 30; } success = this.taskPlanner.RaCloseGripper(defaultforce, out ObjectInHand); command.Parameters = ObjectInHand.ToString(); if (!this.taskPlanner.MovingLeftArm) { this.CommandManager.Busy = false; } response = Response.CreateFromCommand(command, success); TextBoxStreamWriter.DefaultLog.WriteLine("Cmd RaCloseGrip: Sent response: " + response.StringToSend); return(response); } }
public void DestroyPickable() { Destroy(m_pickable); m_objectInHand = ObjectInHand.None; m_pickable = null; }
public void SetObjectInHand(ObjectInHand objectInHand) { m_objectInHand = objectInHand; }