private void OnTriggerExit2D(Collider2D collision) { if (_pipe != null && collision.gameObject == _pipe.gameObject) { _pipe = null; } if (_station != null && collision.gameObject == _station.gameObject) { _station = null; } }
private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Pipe") { _pipe = other.GetComponent <Pipe>(); } if (other.tag == "UpgradeStation") { _station = other.GetComponent <UpgradeStation>(); } }