Added assets from old repo
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
|
||||
// Designed by Jacob Weedman
|
||||
|
||||
public class GroundCheck : MonoBehaviour
|
||||
{
|
||||
public bool isGrounded;
|
||||
float PreviousVelocityY;
|
||||
float CurrentVelocityY = 0;
|
||||
|
||||
void FixedUpdate()
|
||||
{
|
||||
PreviousVelocityY = CurrentVelocityY;
|
||||
if (GetComponent<Rigidbody2D>())
|
||||
CurrentVelocityY = GetComponent<Rigidbody2D>().linearVelocity.y;
|
||||
|
||||
if (PreviousVelocityY == 0 && CurrentVelocityY == 0)
|
||||
isGrounded = true;
|
||||
else
|
||||
isGrounded = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user