예제 #1
0
 protected virtual void Awake()
 {
     m_GameObject = gameObject;
     //
     if (autoPlay)
     {
         alpha = 0.0f;
         if (delay < 0)
         {
             // Do nothing
         }
         else if (delay == 0)
         {
             FadeIn();
         }
         else
         {
             m_DelayedCall = Juggler.Main.DelayCall(() => {
                 FadeIn();
             }, delay);
         }
         // TODO
         if (durationKeep > 0.0f)               // It will fade out automatically.
         {
             onBecameVisible.AddListener(() => {
                 DelayedCall.Free(ref m_DelayedCall);
                 m_DelayedCall = Juggler.Main.DelayCall(() => {
                     FadeOut();
                 }, durationKeep);
             });
         }
     }
 }
예제 #2
0
 public virtual void StartHaptics(int strength, int frequency, float duration = 0.0f)
 {
     DelayedCall.Free(ref m_VibrationDC);
     //
     strength = Mathf.Clamp(strength, 0, 100);        //[0,100],0 -> Default.
     XDevicePlugin.SendMessage(handle, XDevicePlugin.kMessage_TriggerVibration,
                               (int)((strength <= 0?20:strength) | ((frequency << 16) & 0xFFFF0000)),
                               (int)(duration * 1000)
                               );
     if (duration > 0.0f)
     {
         m_VibrationDC = Juggler.Main.DelayCall(StopHaptics, duration);
     }
 }
예제 #3
0
 public virtual void Stop()
 {
     DelayedCall.Free(ref m_DelayedCall);
     //
     m_IsPlaying = false;
 }
예제 #4
0
 protected virtual void OnDestroy()
 {
     DelayedCall.Free(ref m_DelayedCall);
 }
예제 #5
0
 public virtual void StopHaptics()
 {
     DelayedCall.Free(ref m_VibrationDC);
     //
     XDevicePlugin.SendMessage(handle, XDevicePlugin.kMessage_TriggerVibration, -1, 0);
 }