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,50 @@
using HurricaneVR.Framework.Weapons;
using UnityEngine;
namespace HurricaneVR.Framework.Components
{
public class HVRDamageHandler : HVRDamageHandlerBase
{
public float Life = 100f;
public bool Damageable = true;
public Rigidbody Rigidbody { get; private set; }
public HVRDestructible Desctructible;
void Start()
{
Rigidbody = GetComponent<Rigidbody>();
if (!Desctructible)
Desctructible = GetComponent<HVRDestructible>();
}
public override void TakeDamage(float damage)
{
if (Damageable)
{
Life -= damage;
}
if (Life <= 0)
{
if (Desctructible)
{
Desctructible.Destroy();
}
}
}
public override void HandleDamageProvider(HVRDamageProvider damageProvider, Vector3 hitPoint, Vector3 direction)
{
base.HandleDamageProvider(damageProvider, hitPoint, direction);
if (Rigidbody)
{
Rigidbody.AddForceAtPosition(direction.normalized * damageProvider.Force, hitPoint, ForceMode.Impulse);
}
}
}
}