private void OnCollisionEnter(Collision other) { script = other.gameObject.GetComponent <ObjDestroy>(); if ((other.gameObject.tag == "Projectile" && script.objIsActive()) || other.gameObject.tag == "Blade") { if (!actionShield.shieldIsOn()) { if (small && !isChanging) { StartCoroutine(ReturnNormal(playerSize, duration)); } else if (!small) { SceneManager.LoadScene("MainScene"); } } else { return; } } }
//Passively checks for objects within the trigger's range. //NOTE: This is the trigger you should have set up. private void OnCollisionEnter(Collision other) { script = other.gameObject.GetComponent <ObjDestroy>(); if (other.transform.tag == "pickupable") { pickups.Add(other.gameObject); } if (other.transform.tag == "Blade" || other.transform.tag == "Projectile" && script.objIsActive()) { // if (render.enabled == false && collider.enabled == false) { if (isHolding) { //foreach (Transform child in grabPoint) pickup.transform.parent = null; print("lost obj"); isHolding = false; //buttonDown = false; } } }