Advertisement
CakeMeister

Ground Check phan 3

Jun 22nd, 2017
2,724
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class GroundCheck : MonoBehaviour {
  6.  
  7.     public Player player;
  8.  
  9.     // Use this for initialization
  10.     void Start () {
  11.         player = gameObject.GetComponentInParent<Player>();
  12.     }
  13.  
  14.     // Update is called once per frame
  15.     void FixedUpdate()
  16.     {
  17.            
  18.     }
  19.  
  20.     void OnTriggerEnter2D(Collider2D collision)
  21.     {
  22.         player.grounded = true;
  23.     }
  24.  
  25.     private void OnTriggerStay2D(Collider2D collision)
  26.     {
  27.         player.grounded = true;
  28.     }
  29.  
  30.     private void OnTriggerExit2D(Collider2D collision)
  31.     {
  32.         player.grounded = false;
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement