diff options
author | nirav <nirav@airmail.cc> | 2020-12-12 07:18:36 +0000 |
---|---|---|
committer | nirav <nirav@airmail.cc> | 2020-12-12 07:18:36 +0000 |
commit | 115f77bda0246a00f6e17469685c67746bdbd29d (patch) | |
tree | 4bbea1e59109bb1d1fddc71736f89289bab03073 /Assets/Scripts/Player/GroundCheckScript.cs | |
download | 01-master.tar.gz 01-master.zip |
Diffstat (limited to 'Assets/Scripts/Player/GroundCheckScript.cs')
-rwxr-xr-x | Assets/Scripts/Player/GroundCheckScript.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Assets/Scripts/Player/GroundCheckScript.cs b/Assets/Scripts/Player/GroundCheckScript.cs new file mode 100755 index 0000000..4dbace7 --- /dev/null +++ b/Assets/Scripts/Player/GroundCheckScript.cs @@ -0,0 +1,25 @@ +using UnityEngine; +using System.Collections; + +public class GroundCheckScript : MonoBehaviour { + + public PlayerMovementScript player; + + void OnTriggerEnter2D(Collider2D col) + { + if (col.tag == "Ground" || col.tag == "Platform") + player.grounded = true; + } + + void OnTriggerStay2D(Collider2D col) + { + if (col.tag == "Ground" || col.tag == "Platform") + player.grounded = true; + } + + void OnTriggerExit2D(Collider2D col) + { + if (col.tag == "Ground" || col.tag == "Platform") + player.grounded = false; + } +} |