This commit is contained in:
LeeJaeHyun 2024-09-11 15:37:19 +09:00
parent a9477ac2d2
commit 41203be8dc
2 changed files with 15 additions and 1 deletions

View File

@ -809,6 +809,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
moveSpeed: 8
turnSpeed: 200
animator: {fileID: 0}
--- !u!1001 &1157015548
PrefabInstance:
m_ObjectHideFlags: 0

View File

@ -15,10 +15,23 @@ public class PlayerController : MonoBehaviour
void Start()
{
// 컴포넌트 추출 및 할당
animator = this.gameObject.GetComponent<Animator>();
}
void Update()
{
Move();
PlayerAnimation();
}
private void PlayerAnimation()
{
animator.SetFloat("Forward", v);
animator.SetFloat("Strafe", h);
}
private void Move()
{
h = Input.GetAxis("Horizontal"); // 1차원 연속값 -1.0 ~ 0.0 ~ +1.0
v = Input.GetAxis("Vertical"); // -1.0f ~ 0.0f ~ +1.0f