인풋매니저, 리소스매니저 구조 생성 및 리소스 정리
This commit is contained in:
@@ -3,7 +3,6 @@ using TreeEditor;
|
||||
using UnityEngine;
|
||||
using Quaternion = UnityEngine.Quaternion;
|
||||
using Vector3 = UnityEngine.Vector3;
|
||||
|
||||
public class PlayerController : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
@@ -11,44 +10,39 @@ public class PlayerController : MonoBehaviour
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
Managers.Input.KeytAction -= OnKyeboard;
|
||||
Managers.Input.KeytAction += OnKyeboard;
|
||||
}
|
||||
|
||||
float _yAngle = 0.0f;
|
||||
|
||||
void Update()
|
||||
{
|
||||
_yAngle += Time.deltaTime * 100.0f;
|
||||
// 절대 회전값 지정해서 회전
|
||||
// transform.eulerAngles = new Vector3(0.0f, _yAngle, 0.0f);
|
||||
|
||||
// +- delta 값을 특정 축으로 회전
|
||||
// transform.Rotate(new Vector3(0.0f, Time.deltaTime * 100.0f, 0.0f));
|
||||
}
|
||||
|
||||
// transform.rotation = Quaternion.Euler(new Vector3(0.0f, _yAngle, 0.0f));
|
||||
|
||||
void OnKyeboard()
|
||||
{
|
||||
if (Input.GetKey(KeyCode.W))
|
||||
{
|
||||
transform.rotation = Quaternion.LookRotation(Vector3.forward);
|
||||
// transform.Translate(Vector3.forward * Time.deltaTime * _speed);
|
||||
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(Vector3.forward), 0.2f);
|
||||
transform.position += (Vector3.forward * Time.deltaTime * _speed);
|
||||
}
|
||||
|
||||
if (Input.GetKey(KeyCode.S))
|
||||
{
|
||||
transform.rotation = Quaternion.LookRotation(Vector3.back);
|
||||
// transform.Translate(Vector3.back * Time.deltaTime * _speed);
|
||||
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(Vector3.back), 0.2f);
|
||||
transform.position += (Vector3.back * Time.deltaTime * _speed);
|
||||
}
|
||||
|
||||
if (Input.GetKey(KeyCode.A))
|
||||
{
|
||||
transform.rotation = Quaternion.LookRotation(Vector3.left);
|
||||
// transform.Translate(Vector3.left * Time.deltaTime * _speed);
|
||||
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(Vector3.left), 0.2f);
|
||||
transform.position += (Vector3.left * Time.deltaTime * _speed);
|
||||
}
|
||||
|
||||
if (Input.GetKey(KeyCode.D))
|
||||
{
|
||||
transform.rotation = Quaternion.LookRotation(Vector3.right);
|
||||
// transform.Translate(Vector3.right * Time.deltaTime * _speed);
|
||||
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(Vector3.right), 0.2f);
|
||||
transform.position += (Vector3.right * Time.deltaTime * _speed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user