diff options
author | chai <chaifix@163.com> | 2022-02-18 14:38:20 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2022-02-18 14:38:20 +0800 |
commit | 63795c45af9ecca5aea36fbe291b18fcd9fb9b7d (patch) | |
tree | 60d811d8a0b1944ab32d24aa28394183b82cadeb /JamHelper/Assets/JamUtils/FPSControllerVelocity/Scripts/GroundChecker.cs | |
parent | a41c8da0787e0285d4c5b16a5cf5bc3e7a34f521 (diff) |
*rename folder name
Diffstat (limited to 'JamHelper/Assets/JamUtils/FPSControllerVelocity/Scripts/GroundChecker.cs')
-rw-r--r-- | JamHelper/Assets/JamUtils/FPSControllerVelocity/Scripts/GroundChecker.cs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/JamHelper/Assets/JamUtils/FPSControllerVelocity/Scripts/GroundChecker.cs b/JamHelper/Assets/JamUtils/FPSControllerVelocity/Scripts/GroundChecker.cs new file mode 100644 index 0000000..a0bd4eb --- /dev/null +++ b/JamHelper/Assets/JamUtils/FPSControllerVelocity/Scripts/GroundChecker.cs @@ -0,0 +1,48 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace JamTools
+{
+
+ public class GroundChecker : MonoBehaviour
+ {
+ [SerializeField] private Transform m_Foot;
+
+ private List<Collider> m_Colliders = new List<Collider>();
+
+ public Transform foot
+ {
+ get
+ {
+ return m_Foot;
+ }
+ }
+
+ public bool isOnGround
+ {
+ get
+ {
+ return m_Colliders.Count != 0;
+ }
+ }
+
+ private void OnTriggerEnter(Collider other)
+ {
+ if (!m_Colliders.Contains(other))
+ m_Colliders.Add(other);
+ }
+
+ private void OnTriggerExit(Collider other)
+ {
+ if (m_Colliders.Contains(other))
+ m_Colliders.Remove(other);
+ }
+
+ private void OnTriggerStay(Collider other)
+ {
+ }
+
+ }
+
+}
|