using System.Collections; using System.Collections.Generic; using UnityEngine; public class Delivery : MonoBehaviour { [SerializeField] float destroyDelay = 0.5f; bool hasPackage; private void Start() { Debug.Log(hasPackage); } void OnCollisionEnter2D(Collision2D other) { Debug.Log("ouch!"); } void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Package" && !hasPackage == false); { Debug.Log("picked up"); hasPackage = true; Destroy(other.gameObject, destroyDelay); } if (other.tag == "Customer" && hasPackage); { Debug.Log("Delivered"); hasPackage = false; } } }