29 lines
691 B
C#
29 lines
691 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class CheckGround : MonoBehaviour{
|
|
|
|
PlayerController player;
|
|
|
|
// Start is called before the first frame update
|
|
void Start(){
|
|
player = GetComponent<PlayerController>();
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update(){
|
|
|
|
}
|
|
private void OnCollisionStay2D(Collision2D col){
|
|
if (col.gameObject.tag == "Ground"){
|
|
player.grounded = true;
|
|
}
|
|
if (col.gameObject.tag == "Fall"){
|
|
player.grounded = true;
|
|
}
|
|
}
|
|
private void OnCollisionExit2D(Collision2D col){
|
|
player.grounded = false;
|
|
}
|
|
}
|