private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("GateExit")) { GateArea gate = other.gameObject.GetComponent <GateArea>(); interactionButton.SetActive(gate.GetIsEnabled()); } else if (other.gameObject.CompareTag("PlayerPortal")) { interactionButton.SetActive(true); } else if (other.gameObject.CompareTag("Chest") && !other.gameObject.GetComponent <Chest>().isOpened&& other.gameObject.GetComponent <Chest>().isUnlocked) { interactionButton.SetActive(true); } else if (other.gameObject.CompareTag("EnemyOverworld") && other.gameObject.GetComponent <EnemyOverworld>().isBattleReady) { interactionButton.SetActive(true); } else if (other.gameObject.CompareTag("Item") && !other.gameObject.GetComponent <BaseItem>().isPickedUp) { interactionButton.SetActive(true); } else if (other.gameObject.CompareTag("NonSlip")) { StartCoroutine(DelayReset()); } }
private void OnTriggerExit2D(Collider2D other) { if (other.gameObject.CompareTag("GateExit")) { GateArea gate = other.gameObject.GetComponent <GateArea>(); interactionButton.SetActive(false); } else if (other.gameObject.CompareTag("PlayerPortal")) { interactionButton.SetActive(false); } else if (other.gameObject.CompareTag("Chest")) { interactionButton.SetActive(false); } else if (other.gameObject.CompareTag("EnemyOverworld")) { interactionButton.SetActive(false); } else if (other.gameObject.CompareTag("Item")) { interactionButton.SetActive(false); } }