Menu eingebaut, + Keybind Settings

This commit is contained in:
2024-08-13 21:11:05 +02:00
parent 92a8ac7768
commit 3a82d1e682
84 changed files with 18133 additions and 27 deletions

View File

@@ -19,15 +19,14 @@ public class PlayerMoveScript : MonoBehaviour
[SerializeField] private Camera cam;
private Rigidbody rb;
private bool cursorIsLocked;
private LayerMask ground;
private InputManagerScript i;
void Start()
{
rb = GetComponent<Rigidbody>();
Cursor.lockState = CursorLockMode.Locked;
cursorIsLocked = true;
i = GameObject.Find("InputManager").GetComponent<InputManagerScript>();
ground = LayerMask.GetMask("Ground");
}
@@ -37,7 +36,6 @@ public class PlayerMoveScript : MonoBehaviour
jump();
move();
look();
lockCursor();
}
@@ -47,10 +45,10 @@ public class PlayerMoveScript : MonoBehaviour
int moveDirX = 0;;
int moveDirZ = 0;
if(Input.GetKey(KeyCode.W)){moveDirZ++;}
if(Input.GetKey(KeyCode.S)){moveDirZ--;}
if(Input.GetKey(KeyCode.D)){moveDirX++;}
if(Input.GetKey(KeyCode.A)){moveDirX--;}
if(Input.GetKey(i.getMoveForward())){moveDirZ++;}
if(Input.GetKey(i.getMoveBack())){moveDirZ--;}
if(Input.GetKey(i.getMoveRight())){moveDirX++;}
if(Input.GetKey(i.getMoveLeft())){moveDirX--;}
Vector3 moveDir = new Vector3(moveDirX, 0, moveDirZ);
moveDir.Normalize();
@@ -60,7 +58,7 @@ public class PlayerMoveScript : MonoBehaviour
public void jump()
{
if(Input.GetKey(KeyCode.Space))
if(Input.GetKey(i.getJump()))
{
if (Physics.CheckSphere(transform.position + Vector3.down * jumpPointDistance, jumpPointRadius, ground) )
{
@@ -101,22 +99,4 @@ public class PlayerMoveScript : MonoBehaviour
cam.transform.localRotation = Quaternion.Euler(newDirY, 0, 0);
transform.localRotation = Quaternion.Euler(0, newDirX, 0);
}
public void lockCursor()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
if(!cursorIsLocked)
{
Cursor.lockState = CursorLockMode.Locked;
cursorIsLocked = true;
}
else
{
Cursor.lockState = CursorLockMode.None;
cursorIsLocked = false;
}
}
}
}