29 lines
838 B
C#
29 lines
838 B
C#
|
|
using UnityEngine;
|
|||
|
|
|
|||
|
|
public class SimpleTestCamera : MonoBehaviour
|
|||
|
|
{
|
|||
|
|
private float moveSpeed = 100f; // <20>̵<EFBFBD> <20>ӵ<EFBFBD>
|
|||
|
|
private float fastMultiplier = 3f; // Shift Ű <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
void Update()
|
|||
|
|
{
|
|||
|
|
// <20>⺻ <20>Է<EFBFBD> (WASD)
|
|||
|
|
float h = Input.GetAxisRaw("Horizontal"); // A(-1), D(+1)
|
|||
|
|
float v = Input.GetAxisRaw("Vertical"); // W(+1), S(-1)
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Է<EFBFBD> (Q/E)
|
|||
|
|
float y = 0f;
|
|||
|
|
if (Input.GetKey(KeyCode.Q)) y = -1f; // <20>Ʒ<EFBFBD><C6B7><EFBFBD>
|
|||
|
|
if (Input.GetKey(KeyCode.E)) y = 1f; // <20><><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
// <20>̵<EFBFBD> <20><><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><>ǥ <20><><EFBFBD><EFBFBD>)
|
|||
|
|
Vector3 move = new Vector3(h, y, v).normalized;
|
|||
|
|
|
|||
|
|
// Shift Ű <20><><EFBFBD><EFBFBD>
|
|||
|
|
float speed = moveSpeed * (Input.GetKey(KeyCode.LeftShift) ? fastMultiplier : 1f);
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20>̵<EFBFBD>
|
|||
|
|
transform.position += move * speed * Time.deltaTime;
|
|||
|
|
}
|
|||
|
|
}
|