29 lines
763 B
C#
29 lines
763 B
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
public class GroundCheck : MonoBehaviour
|
|||
|
{
|
|||
|
GameObject Player;
|
|||
|
|
|||
|
private void Start()
|
|||
|
{
|
|||
|
Player = gameObject.transform.parent.gameObject;
|
|||
|
}
|
|||
|
private void OnCollisionEnter2D(Collision2D collision)
|
|||
|
{
|
|||
|
if (collision.collider.tag == "Ground" || collision.collider.tag == "Platform")
|
|||
|
{
|
|||
|
Player.GetComponent<Movement2D>().isGrounded = true;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void OnCollisionExit2D(Collision2D collision)
|
|||
|
{
|
|||
|
if (collision.collider.tag == "Ground" || collision.collider.tag == "Platform")
|
|||
|
{
|
|||
|
Player.GetComponent<Movement2D>().isGrounded = false;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|