cvr-props/Assets/ABI.CCK/Components/CVRHapticZone.cs

53 lines
1.5 KiB
C#
Raw Permalink Normal View History

2023-01-22 16:38:23 +01:00
using UnityEngine;
namespace ABI.CCK.Components
{
[AddComponentMenu("ChilloutVR/CVR Haptic Zone")]
[HelpURL("https://developers.abinteractive.net/cck/components/haptic-zone/")]
public class CVRHapticZone : MonoBehaviour, ICCK_Component
2023-01-22 16:38:23 +01:00
{
public enum TriggerForm
{
Box = 1,
Sphere = 2
}
public TriggerForm triggerForm = TriggerForm.Box;
public Vector3 center = Vector3.zero;
public Vector3 bounds = Vector3.one;
public enum TriggerTiming
{
once = 1,
continuous = 2,
random = 3
}
public bool enableOnEnter = false;
public float onEnterIntensity = 0.2f;
public bool enableOnStay = false;
public float onStayIntensity = 0.2f;
public TriggerTiming onStayTiming = TriggerTiming.continuous;
public float onStayChance = 0.1f;
public bool enableOnExit = false;
public float onExitIntensity = 0.2f;
public void OnDrawGizmos()
{
Gizmos.color = Color.yellow;
Matrix4x4 rotationMatrix = Matrix4x4.TRS(transform.position, transform.rotation, transform.lossyScale);
Gizmos.matrix = rotationMatrix;
if (triggerForm == TriggerForm.Box)
{
Gizmos.DrawWireCube(center, bounds);
}
else
{
Gizmos.DrawWireSphere(center, bounds.x);
}
}
}
}