init
This commit is contained in:
commit
a8c6025cd3
158 changed files with 86052 additions and 0 deletions
29
Assets/Scripts/CheckGround.cs
Normal file
29
Assets/Scripts/CheckGround.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue