private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Trap") { main.Wed_Die(); } }
private void OnTriggerEnter2D(Collider2D other) { bool death = false; Rigidbody2D otherRigidbody = other.gameObject.GetComponentInChildren <Rigidbody2D>(); if (otherRigidbody != null) { if (otherRigidbody.tag == "Wall") { if (onDash) { if (Mathf.Abs(main.rigidbodyComponent.velocity.x - otherRigidbody.velocity.x) > horizontalMax + dashAdjust) { death = true; } } else { if (Mathf.Abs(main.rigidbodyComponent.velocity.x - otherRigidbody.velocity.x) > horizontalMax) { death = true; } } } } if (death) { main.Wed_Die(); } }
private void OnTriggerEnter2D(Collider2D other) { bool death = false; Rigidbody2D otherRigidbody = other.gameObject.GetComponentInChildren <Rigidbody2D>(); if (otherRigidbody != null) { if (otherRigidbody.tag == "Wall") { if (main.groundedTester.IsGrounded) { if (Mathf.Abs(main.rigidbodyComponent.velocity.y - otherRigidbody.velocity.y) > verticalGroundMax) { death = true; } } else { if (Mathf.Abs(main.rigidbodyComponent.velocity.y - otherRigidbody.velocity.y) > verticalMax) { death = true; } } } } if (death) { main.Wed_Die(); } }