Пример #1
0
 /// <summary>
 /// Returns how far this effect has advanced in fractional seconds.
 /// Returns a value less than 0 on failure.
 /// </summary>
 /// <returns></returns>
 public unsafe float GetElapsedTime()
 {
     Interop.HLVR_EffectInfo info = new Interop.HLVR_EffectInfo();
     if (Interop.OK(Interop.HLVR_Effect_GetInfo(_handle, ref info)))
     {
         return(info.Elapsed);
     }
     else
     {
         return(-1.0f);
     }
 }
Пример #2
0
        /// <summary>
        /// If we want to construct the handle for the very first time, we have no duration info present.
        /// So we end up calculating it in the constructor, then caching it. Subsequent Clones() will copy the duration
        ///
        /// </summary>
        /// <param name="creator"></param>
        internal HapticHandle(CommandWithHandle creator)
        {
            init(creator);

            Interop.HLVR_EffectInfo info = new Interop.HLVR_EffectInfo();

            //Failure by default
            int result = -1;

            unsafe
            {
                result = Interop.HLVR_Effect_GetInfo(_handle, ref info);
            }

            if (Interop.OK(result))
            {
                _duration = info.Duration;
            }
            else
            {
                Debug.LogError(string.Format("Failed to fetch information about haptic handle; the handle has been disposed and is no longer usable.\n"));
            }
        }