void PlayerSpecialInteractions() { currentCoverRotationY = feetScript.CoverRotation(); currentPushRotationY = feetScript.PushRotation(); currentPushedObject = feetScript.PushedObject(); currentPushedTrigger = feetScript.PushedObjTrigger(); canInteract = interactionScript.InteractionCollisionBool(); if (feetScript.VaultTarget() != null) { currentTargetVault = feetScript.VaultTarget(); } if (feetOnCover) //Gets In and Out of cover { if (Input.GetKeyDown(KeyCode.E) && !onPush) { if (!Globals.SACO_NA_MAO) { if (onCover == false) { onCover = true; } else { onCover = false; } } } } else { onCover = false; } if (feetOnHide) { if (Input.GetKeyDown(KeyCode.E) && allowToHide) { if (!Globals.SACO_NA_MAO) { if (hidden) { //anim.UnHide(); allowToHide = false; StartCoroutine("WaitForUnHide"); playerCanMove = true; } else { this.transform.rotation = currentPushRotationY; anim.Hide(); allowToHide = false; StartCoroutine("WaitForHide"); playerCanMove = false; StopCoroutine(stepCoroutine); } StartCoroutine(WaitForHideAnimation()); } } } if (feetOnVault) //look if the feets are on the vault trigget, so the player can vault { if (Input.GetKeyDown(KeyCode.Space) && !onPush) { if (!Globals.SACO_NA_MAO) { audioPlay.PlayJump(); this.transform.position = currentTargetVault; } } } if (feetOnPush) //make the player push a box or object { if (!Globals.SACO_NA_MAO) { if (Input.GetKeyDown(KeyCode.E) && !onPush) { anim.Push(true); onPush = true; this.transform.rotation = currentPushRotationY; this.transform.position = currentPushedTrigger.transform.position; currentPushedObject.transform.parent = this.gameObject.transform; currentPushedObject.GetComponent <PushInteraction>().WallsInteraction(true); // Make the invisble walls appear } else if (Input.GetKeyDown(KeyCode.E) && onPush) { anim.Push(false); onPush = false; currentPushedObject.transform.parent = null; currentPushedObject.GetComponent <PushInteraction>().WallsInteraction(false); //Make the invisible walls disappear } } else { onPush = false; if (currentPushedObject != null) { currentPushedObject.transform.parent = null; } } } if (canInteract) { if (Input.GetKeyDown(KeyCode.E)) //Interaction With Objects { pickedObject = interactionScript.InteractionCollisionGameObject(); if (pickedObject.CompareTag(Globals.TAG_INTERACTABLE_OBJECT) && !itemInHand) { if (!Globals.SACO_NA_MAO) { //m_ControlAnim.PickUp(); StartCoroutine("WaitForPickAnim"); anim.PickUp(); itemInHand = true; } } else if (pickedObject.CompareTag(Globals.TAG_MAIN_OBJECT) && !itemInHand) { Globals.SACO_NA_MAO = true; anim.Olhar(); playerCanMove = false; StartCoroutine(WaitForPickAnimation()); finalPicked = true; pickedObjRef = pickedObject.gameObject; } else if (pickedObject.CompareTag(Globals.TAG_SACO_FALSO)) { if (!Globals.SACO_NA_MAO) { anim.Olhar(); playerCanMove = false; StartCoroutine(WaitForPickAnimationFalse()); pickedObject.GetComponent <CapsuleCollider>().enabled = false; pickedObject.GetComponent <GlowItens>().enabled = false; interactionScript.DeleteReferences(); } } else if (itemInHand && pickedObjRef != null) { Globals.SACO_NA_MAO = false; pickedObjRef.transform.parent = null; pickedObjRef.GetComponent <FinalInteractiveObject>().TurnRbOn(); itemInHand = false; pickedObjRef.GetComponent <Rigidbody>().useGravity = true; pickedObjRef = null; } else { print("Out"); } } } }