From 16f9db5942a1ae6b15f0d760984ca48cbb61df33 Mon Sep 17 00:00:00 2001 From: LeeJaeHyun Date: Wed, 11 Sep 2024 14:45:03 +0900 Subject: [PATCH] . --- Assets/01_Scenes/GameLogic.unity | 1 + Assets/02_Scripts/PlayerController.cs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Assets/01_Scenes/GameLogic.unity b/Assets/01_Scenes/GameLogic.unity index 311a8f2..136f97a 100644 --- a/Assets/01_Scenes/GameLogic.unity +++ b/Assets/01_Scenes/GameLogic.unity @@ -732,6 +732,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 22f91d763663a4c6290b8d64b02ce4c7, type: 3} m_Name: m_EditorClassIdentifier: + moveSpeed: 8 --- !u!1001 &1157015548 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/02_Scripts/PlayerController.cs b/Assets/02_Scripts/PlayerController.cs index a5bdfba..5ce5bd5 100644 --- a/Assets/02_Scripts/PlayerController.cs +++ b/Assets/02_Scripts/PlayerController.cs @@ -6,8 +6,10 @@ public class PlayerController : MonoBehaviour { private float h; private float v; + private float r; - public float moveSpeed = 5.0f; + [SerializeField] private float moveSpeed = 5.0f; + [SerializeField] private float turnSpeed = 200.0f; void Start() { @@ -18,6 +20,7 @@ public class PlayerController : MonoBehaviour { h = Input.GetAxis("Horizontal"); // 1차원 연속값 -1.0 ~ 0.0 ~ +1.0 v = Input.GetAxis("Vertical"); // -1.0f ~ 0.0f ~ +1.0f + r = Input.GetAxis("Mouse X"); // 마우스의 X축 이동 변위값(Delta Value) // 벡터의 덧셈연산 => 벡터의 정규화 (Vector Normalized) Vector3 moveDir = (Vector3.forward * v) + (Vector3.right * h);