void CheckChestState(bool isOpen) { if (!isOpen) { if (_dialogBox != null && _dialogText != null) { _dialogBox.SetActive(true); _dialogText.text = _content.ItemDescription; } _playerInventory.AddItem(_content); _playerInventory.CurrentItem = _content; _dropItem.Raise(); _isOpen = true; TogglePopUp.Raise(); _animator.SetTrigger("chestOpen"); _storedOpen.RuntimeValue = _isOpen; } else { if (_dialogBox != null) { _dialogBox.SetActive(false); } _dropItem.Raise(); } }
protected override void OnTriggerExit2D(Collider2D other) { if (other.CompareTag("Player") && !other.isTrigger && !_isOpen) { TogglePopUp.Raise(); PlayerInRange = false; } }
void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player") && !other.isTrigger && !_isOpen) { PlayerInRange = true; TogglePopUp.Raise(); } }
protected override void OnTriggerExit2D(Collider2D other) { if (other.CompareTag("Player") && !other.isTrigger) { TogglePopUp.Raise(); PlayerInRange = false; _dialogBox.SetActive(false); } }
public virtual void Update() { if (Input.GetKeyDown(KeyCode.E) && PlayerInRange) { if (_dialogBox.activeInHierarchy) { _dialogBox.SetActive(false); TogglePopUp.Raise(); } else { _dialogBox.SetActive(true); TogglePopUp.Raise(); _dialogText.text = _dialog; } } }