Commit 815dbbec authored by Mikko Lainio's avatar Mikko Lainio
Browse files

added mouse axis controls.

parent 6654bdd2
......@@ -1902,7 +1902,7 @@ MonoBehaviour:
m_growthBuffer: 10
m_plotRenderer: {fileID: 797969627}
m_plotAccuracy: 1
m_plotVisualizeMode: 0
m_plotVisualizeMode: 1
m_noise: 0.05000000074505806
m_randomizeNoise: 1
TimeSteps: 1000
......@@ -2694,6 +2694,9 @@ MonoBehaviour:
m_EditorClassIdentifier:
MoveLeft: 276
MoveRight: 275
useAxis: 1
AxisName: Mouse Y
invert: 0
cPosition: 2
textObj: {fileID: 603228699}
--- !u!135 &1088347439
......@@ -3332,6 +3335,9 @@ MonoBehaviour:
m_EditorClassIdentifier:
MoveLeft: 97
MoveRight: 100
useAxis: 1
AxisName: Mouse X
invert: 0
cPosition: 1
textObj: {fileID: 1883072454}
--- !u!135 &2032928272
......
......@@ -14,12 +14,17 @@ public class WellController : MonoBehaviour
public KeyCode MoveLeft = KeyCode.A;
public KeyCode MoveRight = KeyCode.D;
public bool useAxis = true;
public string AxisName;
public bool invert = false;
public CubePosition cPosition;
private Vector3 m_defaultPos;
public TMPro.TextMeshProUGUI textObj;
private bool m_noMove = false;
// Start is called before the first frame update
void Awake()
......@@ -46,7 +51,6 @@ public class WellController : MonoBehaviour
t += Time.deltaTime;
float pt = t / time;
transform.position = (Vector3.Lerp(start, p, pt));
}
m_noMove = false;
......@@ -55,16 +59,22 @@ public class WellController : MonoBehaviour
// Update is called once per frame
void Update()
{
if (Input.GetKey(MoveLeft))
if (useAxis)
{
Move(-1f);
float value = Input.GetAxis(AxisName);
Move(value*(invert?-1f:1f));
}
else if (Input.GetKey(MoveRight))
else
{
Move(1f);
if (Input.GetKey(MoveLeft))
{
Move(-1f);
}
else if (Input.GetKey(MoveRight))
{
Move(1f);
}
}
}
// private void FixedUpdate()
......@@ -98,7 +108,7 @@ public class WellController : MonoBehaviour
{
if (m_noMove)
return;
transform.position += Vector3.right * dir * Time.deltaTime;
//clamp the position
......@@ -110,5 +120,4 @@ public class WellController : MonoBehaviour
}
public float CurrentInputPosition => transform.position.x - m_defaultPos.x;
}
}
\ No newline at end of file
......@@ -106,6 +106,11 @@ PlayerSettings:
xboxOneDisableEsram: 0
xboxOnePresentImmediateThreshold: 0
switchQueueCommandMemory: 0
switchQueueControlMemory: 16384
switchQueueComputeMemory: 262144
switchNVNShaderPoolsGranularity: 33554432
switchNVNDefaultPoolsGranularity: 16777216
switchNVNOtherPoolsGranularity: 16777216
vulkanEnableSetSRGBWrite: 0
m_SupportedAspectRatios:
4:3: 1
......@@ -420,6 +425,7 @@ PlayerSettings:
switchAllowsRuntimeAddOnContentInstall: 0
switchDataLossConfirmation: 0
switchUserAccountLockEnabled: 0
switchSystemResourceMemory: 16777216
switchSupportedNpadStyles: 3
switchNativeFsCacheSize: 32
switchIsHoldTypeHorizontal: 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment