43 lines
931 B
C#
43 lines
931 B
C#
using Oculus.Interaction;
|
|
using Unity.Cinemachine;
|
|
using UnityEngine;
|
|
using UnityEngine.InputSystem;
|
|
|
|
public class CinemachinePositionComposerController : MonoBehaviour
|
|
{
|
|
[Header("Input Actions")]
|
|
public InputActionReference zoomAction;
|
|
|
|
public CinemachinePositionComposer positionComposer;
|
|
|
|
private bool zoomBlocked = false;
|
|
|
|
private void OnEnable()
|
|
{
|
|
if (zoomAction != null)
|
|
zoomAction.action.Enable();
|
|
}
|
|
|
|
|
|
|
|
void Update()
|
|
{
|
|
if (zoomAction != null && !zoomBlocked)
|
|
{
|
|
Vector2 zoomValue = zoomAction.action.ReadValue<Vector2>();
|
|
positionComposer.CameraDistance = positionComposer.CameraDistance - zoomValue.y * 0.25f;
|
|
}
|
|
|
|
}
|
|
|
|
public void SetBlocker(bool value)
|
|
{
|
|
zoomBlocked = value;
|
|
}
|
|
|
|
public void SetLookahead(bool value)
|
|
{
|
|
positionComposer.Lookahead.Enabled = value;
|
|
}
|
|
}
|