// used to detect collisions with obstacles void OnTriggerEnter(Collider other) { if (other.collider.gameObject.tag == "Box") // (colliderCooldown <= 0 && { BoxScript thisBoxScript = other.collider.gameObject.GetComponent <BoxScript>(); thisBoxScript.GetHit(gameObject, false); if (thisBoxScript.boxType <= 0 && playerHP > 0) { PlayerTakeDamage(1, "Box"); } } }