.
This commit is contained in:
parent
a9477ac2d2
commit
41203be8dc
@ -809,6 +809,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
moveSpeed: 8
|
||||
turnSpeed: 200
|
||||
animator: {fileID: 0}
|
||||
--- !u!1001 &1157015548
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user