Files
2023-06-11 00:35:07 +03:00

21 lines
536 B
C#

using UnityEngine;
public class GroundDetection : MonoBehaviour {
public bool isGrounded { get; private set; }
private void OnCollisionStay2D(Collision2D other) {
if (other.gameObject.CompareTag("Platform") || other.gameObject.CompareTag("Enemy")) {
isGrounded = true;
}
}
private void OnCollisionExit2D(Collision2D other) {
if (other.gameObject.CompareTag("Platform") || other.gameObject.CompareTag("Enemy")) {
isGrounded = false;
}
}
}