summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Player/GroundCheckScript.cs
blob: 4dbace7692643b15472c5f5187cd3745fd79d01e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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;         
    }
}