private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { PlayerPizzaController pizzaManager = other.GetComponent <PlayerPizzaController>(); if (pizzaManager.pizza < 1) { StartCoroutine(TellPlayerToPickPizza(other)); } } }
private void OnTriggerStay2D(Collider2D collision) { if (collision.CompareTag("Player")) { if (!_GotPizzaDelivered) { _GotPizzaDelivered = true; StartCoroutine(ShowMessage(collision)); } if (Input.GetKeyDown(KeyCode.E)) { PlayerPizzaController ppc = collision.GetComponent <PlayerPizzaController>(); if (ppc.pizza == 1) { ppc.pizza--; _SpeechBubble2.SetActive(true); } } } }