UnityProjekt/Assets/Scripts/CharacterControllerBase.cs
NorbiPeti 93de3681f0
Animations!
Animations for walking, running, jumping while running
Improved ground detection
Fixed some character functionality not working above a certain speed
2020-11-18 00:11:03 +01:00

18 lines
No EOL
511 B
C#

using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public abstract class CharacterControllerBase : MonoBehaviour
{
protected Rigidbody2D _rb;
public Transform foot;
public float groundRadius;
public LayerMask groundMask;
public bool IsOnGround(string groundName = "")
{
var collider = Physics2D.OverlapCircle(foot.position, groundRadius, groundMask);
return collider && (groundName.Length == 0 || collider.name.StartsWith(groundName));
}
}