Removed TopDown View without deadzone. Exchanged Deadzone with Lookahead. Added Zoom to TopDown View

This commit is contained in:
Thorbjoern
2025-07-19 18:14:39 +02:00
parent 0594f7c42b
commit aff0db9b64
6 changed files with 288 additions and 127 deletions
-7
View File
@@ -2,13 +2,6 @@ using UnityEngine;
public class ActiveToggle : MonoBehaviour
{
public GameObject gameObject;
public void ToggleActive()
{
gameObject.SetActive(!gameObject.activeSelf);
}
public void ToggleActive(GameObject obj)
{
obj.SetActive(!obj.activeSelf);
@@ -0,0 +1,42 @@
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;
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 4d094cb092662b64c925f5d3aff0cc5c
@@ -0,0 +1,18 @@
using UnityEngine;
using UnityEngine.Events;
public class EnableDisableActions : MonoBehaviour
{
[SerializeField] UnityEvent onEnable;
[SerializeField] UnityEvent onDisable;
private void OnEnable()
{
onEnable.Invoke();
}
private void OnDisable()
{
onDisable.Invoke();
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 91dc9a5d938f31646aa29634858590b0