添加插件
This commit is contained in:
@@ -19,6 +19,8 @@ namespace FIMSpace.Basics
|
||||
/// <summary> Just multiplier for rotation </summary>
|
||||
public float MouseSensitivity = 5f;
|
||||
|
||||
public bool NeedRMB = true;
|
||||
|
||||
/// <summary> Variables controlling turbo speed on shift key </summary>
|
||||
private float turboModeMultiply = 5f;
|
||||
|
||||
@@ -45,6 +47,7 @@ namespace FIMSpace.Basics
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
// Detecting key movement factors
|
||||
float f = Input.GetAxis("Vertical");
|
||||
float r = Input.GetAxis("Horizontal");
|
||||
@@ -65,11 +68,14 @@ namespace FIMSpace.Basics
|
||||
forward *= turbo;
|
||||
right *= turbo;
|
||||
|
||||
// Movement to sides with pressed rmb
|
||||
if (Input.GetMouseButton(1))
|
||||
if (Cursor.lockState != CursorLockMode.None)
|
||||
{
|
||||
rotation.x -= (Input.GetAxis("Mouse Y") * 1f * MouseSensitivity);
|
||||
rotation.y += (Input.GetAxis("Mouse X") * 1f * MouseSensitivity);
|
||||
// Rotation with pressed rmb
|
||||
if (Input.GetMouseButton(1) || !NeedRMB )
|
||||
{
|
||||
rotation.x -= (Input.GetAxis("Mouse Y") * 1f * MouseSensitivity);
|
||||
rotation.y += (Input.GetAxis("Mouse X") * 1f * MouseSensitivity);
|
||||
}
|
||||
}
|
||||
|
||||
// Lerping speed variables for smooth effect
|
||||
@@ -112,8 +118,11 @@ namespace FIMSpace.Basics
|
||||
}
|
||||
else
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
if (NeedRMB)
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user