24 lines
616 B
C#
24 lines
616 B
C#
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);
|
|
}
|
|
}
|
|
} |