Replace UltimateXR with HurricaneVR

This commit is contained in:
2024-08-08 17:01:07 +02:00
parent e8658374d6
commit fb21dbbb73
5932 changed files with 358362 additions and 2174150 deletions

View File

@@ -0,0 +1,48 @@
using System.Collections;
using HurricaneVR.Framework.Core;
using HurricaneVR.Framework.Core.Grabbers;
using UnityEngine;
namespace HurricaneVR.Framework.Weapons.Guns
{
public class HVRGrabMagazine : HVRHandGrabEvent
{
public float GrabDelay = .05f;
public HVRSocket MagSocket;
protected WaitForSeconds Timeout;
protected override void Awake()
{
base.Awake();
Timeout = new WaitForSeconds(GrabDelay);
}
protected override bool CheckEnableGrab()
{
return MagSocket && MagSocket.IsGrabbing;
}
protected override void OnHandGrabbed(HVRHandGrabber hand, HVRGrabbable arg1)
{
base.OnHandGrabbed(hand, arg1);
if (MagSocket && MagSocket.GrabbedTarget)
{
var ammo = MagSocket.GrabbedTarget;
MagSocket.ForceRelease();
StartCoroutine(GrabRoutine(ammo, hand));
}
}
protected IEnumerator GrabRoutine(HVRGrabbable ammo, HVRHandGrabber hand)
{
//yield return Timeout;
yield return new WaitForSeconds(GrabDelay);
if (ammo && !ammo.IsBeingHeld && !hand.GrabbedTarget)
{
hand.TryGrab(ammo, true);
}
}
}
}