1
0
forked from cgvr/DeltaVR

deltavr multiplayer 2.0

This commit is contained in:
Toomas Tamm
2023-05-08 15:56:10 +03:00
parent 978809a002
commit 07b9b9e2f4
10937 changed files with 2968397 additions and 1521012 deletions

View File

@@ -0,0 +1,45 @@
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.XR.Interaction.Toolkit;
public class ActivateTeleportationRay : MonoBehaviour
{
public GameObject teleportRay;
public float rayHideDelay = 0.1f;
public InputActionProperty activateTeleportRay;
public TeleportationProvider teleportationProvider;
// Update is called once per frame
private void Start()
{
teleportRay.SetActive(false);
activateTeleportRay.action.performed += ShowRay;
activateTeleportRay.action.canceled += HideRayPerformed;
teleportationProvider.endLocomotion += HideRayPerformed;
}
private void HideRayPerformed(InputAction.CallbackContext obj)
{
if (!teleportRay.activeSelf) return;
if (IsInvoking(nameof(HideRay))) return;
Invoke(nameof(HideRay), rayHideDelay);
}
private void HideRayPerformed(LocomotionSystem obj)
{
if (!teleportRay.activeSelf) return;
if (IsInvoking(nameof(HideRay))) return;
Invoke(nameof(HideRay), rayHideDelay);
}
private void ShowRay(InputAction.CallbackContext obj)
{
teleportRay.SetActive(true);
}
private void HideRay()
{
teleportRay.SetActive(false);
}
}