updated controller to use legacy input system axis
This commit is contained in:
@@ -2,21 +2,16 @@ using UnityEngine;
|
||||
|
||||
public class PlayerController : MonoBehaviour
|
||||
{
|
||||
private float direction = 1.0f;
|
||||
[SerializeField][Range(0.1f, 50f)] private float moveSpeed = 0.5f;
|
||||
[SerializeField] private float vertical;
|
||||
[SerializeField] private float horizontal;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
Debug.Log("FPS: " + (1.0f / Time.deltaTime));
|
||||
|
||||
if (transform.position.z >= 175)
|
||||
{
|
||||
direction = -direction;
|
||||
}else if (transform.position.z <= 10)
|
||||
{
|
||||
direction = -direction;
|
||||
}
|
||||
horizontal = Input.GetAxisRaw("Horizontal");
|
||||
vertical = Input.GetAxisRaw("Vertical");
|
||||
|
||||
transform.Translate(0.0f, 0.0f, moveSpeed * direction * Time.deltaTime);
|
||||
transform.Translate(Vector3.forward * (vertical * Time.deltaTime * moveSpeed));
|
||||
transform.Rotate(Vector3.up * (horizontal * Time.deltaTime * moveSpeed));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,11 @@
|
||||
"dependencies": {
|
||||
"com.unity.collab-proxy": "2.11.3",
|
||||
"com.unity.feature.development": "1.0.1",
|
||||
"com.unity.textmeshpro": "3.0.7",
|
||||
"com.unity.textmeshpro": "3.0.9",
|
||||
"com.unity.timeline": "1.7.7",
|
||||
"com.unity.toolchain.linux-x86_64": "2.0.11",
|
||||
"com.unity.ugui": "1.0.0",
|
||||
"com.unity.visualscripting": "1.9.4",
|
||||
"com.unity.visualscripting": "1.9.9",
|
||||
"com.unity.modules.ai": "1.0.0",
|
||||
"com.unity.modules.androidjni": "1.0.0",
|
||||
"com.unity.modules.animation": "1.0.0",
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.textmeshpro": {
|
||||
"version": "3.0.7",
|
||||
"version": "3.0.9",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
@@ -152,7 +152,7 @@
|
||||
}
|
||||
},
|
||||
"com.unity.visualscripting": {
|
||||
"version": "1.9.4",
|
||||
"version": "1.9.9",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
|
||||
Reference in New Issue
Block a user