bool CheckInstance()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         if (instance != this)
         {
             // already exist destroy new one
             Destroy(gameObject);
             return(false);
         }
     }
     return(true);
 }
Esempio n. 2
0
 public static IReadOnlyReactiveProperty <AxisOrangeUnityData> SensorDataUpdateEventFilterBy(this AxisOrangePlugin plugin, int id)
 {
     return(Observable
            .FromEvent <Action <int, AxisOrangeUnityData>, AxisOrangeUnityData>(
                h => (i, x) => { if (i == id)
                                 {
                                     h.Invoke(x);
                                 }
                },
                h => plugin.SensorDataUpdateEvent += h,
                h => plugin.SensorDataUpdateEvent -= h)
            .ToReadOnlyReactiveProperty());
 }
Esempio n. 3
0
 public static IObservable <Unit> SensorButtonBReleaseTriggerObservableFilterBy(this AxisOrangePlugin plugin, int id)
 {
     return(plugin
            .SensorButtonUpdateEventFilterBy(id)
            .ButtonBReleaseTriggerObservable());
 }