namespace Zinnia.Haptics { using UnityEngine; using Zinnia.Extension; /// /// Creates a single pulse on a haptic device for a given intensity. /// public abstract class HapticPulser : HapticProcess { [Tooltip("The intensity of the haptic rumble.")] [SerializeField] [Range(0f, 1f)] private float intensity = 1f; /// /// The intensity of the haptic rumble. /// public float Intensity { get { return intensity; } set { intensity = value; if (this.IsMemberChangeAllowed()) { OnAfterIntensityChange(); } } } /// /// Called after has been changed. /// protected virtual void OnAfterIntensityChange() { intensity = Mathf.Clamp01(Intensity); } } }