Attempt to get animation working
This commit is contained in:
21
Assets/Scripts/Player/Player.cs
Normal file
21
Assets/Scripts/Player/Player.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Scampz.GameJam.Assets.Scripts.Player
|
||||
{
|
||||
public class Player : MonoBehaviour
|
||||
{
|
||||
private Animator _animator;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_animator = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var player = GameObject.FindGameObjectWithTag("Player");
|
||||
var cc = player.GetComponent<CharacterController>();
|
||||
_animator.SetFloat("Speed", cc.velocity.magnitude);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user