Skip to content

Commit 0109d7b

Browse files
committed
Added Link to Spaceship Holo Table
1 parent 1c89054 commit 0109d7b

6 files changed

Lines changed: 510 additions & 110 deletions

File tree

Assets/Samples/SpaceshipHoloTable/Script/SpaceshipHoloTableZoomControl.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Cinemachine;
12
using System.Collections;
23
using System.Collections.Generic;
34
using UnityEngine;
@@ -13,9 +14,33 @@ public class SpaceshipHoloTableZoomControl : MonoBehaviour
1314
public UnityEngine.Rendering.Volume m_PostProcessVolume;
1415
public Vector2 ZoomInOutFov = new Vector2(40,75);
1516
public float dampen = 14f;
17+
public int MouseRotateButton = 1;
1618

1719
float m_CachedValue = 0.0f;
1820

21+
CinemachineCore.AxisInputDelegate m_AxisDelegateBackup;
22+
23+
private void OnEnable()
24+
{
25+
m_AxisDelegateBackup = CinemachineCore.GetInputAxis;
26+
CinemachineCore.GetInputAxis = GetInputAxis;
27+
}
28+
29+
float GetInputAxis(string axisName)
30+
{
31+
if (Input.GetMouseButton(MouseRotateButton))
32+
{
33+
return Input.GetAxis(axisName);
34+
}
35+
else
36+
return 0;
37+
}
38+
39+
private void OnDisable()
40+
{
41+
CinemachineCore.GetInputAxis = m_AxisDelegateBackup;
42+
}
43+
1944
// Update is called once per frame
2045
void Update()
2146
{
@@ -30,5 +55,16 @@ void Update()
3055
m_PostProcessVolume.weight = value;
3156
m_Camera.m_Lens.FieldOfView = Mathf.Lerp(ZoomInOutFov.y, ZoomInOutFov.x, m_CachedValue);
3257
}
58+
59+
if(Input.GetMouseButton(MouseRotateButton))
60+
{
61+
Cursor.visible = false;
62+
Cursor.lockState = CursorLockMode.Locked;
63+
}
64+
else
65+
{
66+
Cursor.visible = true;
67+
Cursor.lockState = CursorLockMode.None;
68+
}
3369
}
3470
}

0 commit comments

Comments
 (0)