캐릭터 이동 코드 구현
This commit is contained in:
19
Assets/Scripts/PlayerController.cs
Normal file
19
Assets/Scripts/PlayerController.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerController : MonoBehaviour
|
||||
{
|
||||
private Movement2D movement2D;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
movement2D = GetComponent<Movement2D>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
float x = Input.GetAxis("Horizontal");
|
||||
float y = Input.GetAxis("Vertical");
|
||||
|
||||
movement2D.MoveDirection = new Vector2(x, y);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user