private void OnMouseOver() { if (Vector3.Distance(transform.position, player.transform.position) < 5) { if (playerItemScript.GetHasItem() == false || itemAccepted) { displayTextScript.SetEnabled(false); } else { displayTextScript.SetEnabled(true); playerItemScript.AllowDroppingItems(false); if (playerItemScript.GetHeldObject().name == itemToAccept.name && Input.GetKeyDown(KeyCode.E)) { playerItemScript.DisableItemOnPedestal(); playerItemScript.GetItemPlace(itemPlace); playerItemScript.TriggerAnimPlace(); itemAccepted = true; m_MyAudioSource.Play(); if (doorManagerScript != null) { doorManagerScript.CheckWinCondition(); } else if (gateManagerScript != null) { gateManagerScript.OpenGate(); } else { Debug.Log(gameObject.name + " is missing door reference"); } } } } }
// Update is called once per frame void Update() { if (OPENVARANTSER) { OPENVARANTSER = false; openGate = true; displayTextScript.SetEnabled(false); leverAnim.SetTrigger("leverDown"); } }
private void OnMouseOver() { if (Vector3.Distance(transform.position, player.transform.position) < 5) { if (Input.GetKeyDown(KeyCode.E) && !openChest) { openChest = true; displayTextScript.SetEnabled(false); animChest.SetTrigger("openChest"); m_MyAudioSource.Play(); } } }
private void OnMouseOver() { if (Vector3.Distance(transform.position, player.transform.position) < 5) { if (playerItemScript.GetHeldObject().CompareTag("Key")) { displayTextScript.SetText("Press E to unlock"); } if (Input.GetKeyDown(KeyCode.E) && !openChest && playerItemScript.GetHeldObject().CompareTag("Key")) { openChest = true; displayTextScript.SetEnabled(false); animChest.SetTrigger("openChest"); playerItemScript.DestroyKey(); m_MyAudioSource.Play(); } } }
//When placed on pedestal should no longer be able to pickup public void SetIsPlaced() { isPlaced = true; displayTextScript.SetEnabled(false); }