void OnTriggerStay2D(Collider2D collision) { IMassive massComponent = collision.GetComponent <IMassive>(); // The colliding object will begin falling if the point on the bottom of the object's collider is contained inside of the collider on this pit if (massComponent != null && !massComponent.isFalling() && m_Collider2D.bounds.Contains(collision.bounds.center - new Vector3(0, collision.bounds.size.y / 2, collision.bounds.center.z))) { if (collision.CompareTag("Block")) { massComponent.Fall(fallingRate); Destroy(gameObject); } else { massComponent.Fall(fallingRate); audioPlayer.PlaySFX(fallsfx); } } }
void OnTriggerStay2D(Collider2D collision) { IMassive massComponent = collision.GetComponent <IMassive>(); // The colliding object will begin falling if the point on the bottom of the object's collider is contained inside of the collider on this pit if (massComponent != null && !massComponent.isFalling() && m_Collider2D.bounds.Contains(collision.bounds.center - new Vector3(0, collision.bounds.size.y / 2, collision.bounds.center.z))) { if (collision.CompareTag("Player")) { massComponent.Fall(fallingRate); UI_Manager.WinGame(); } } }