init
This commit is contained in:
24
Assets/Scripts/Player/PlayerMotion.cs
Normal file
24
Assets/Scripts/Player/PlayerMotion.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using Keyboard;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Player
|
||||
{
|
||||
public class PlayerMotion : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Rigidbody rb;
|
||||
[SerializeField] private Animator animator;
|
||||
private Vector3 _velocity;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
Run();
|
||||
}
|
||||
|
||||
private void Run()
|
||||
{
|
||||
_velocity = KeySettingManager.Instance.Direction.x * transform.right + KeySettingManager.Instance.Direction.y * transform.forward;
|
||||
rb.AddForce(_velocity.normalized * (Time.deltaTime * 10), ForceMode.Impulse);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user