Esempio n. 1
0
 /// <summary>
 /// Register a new trigger to the layer to track and update.
 /// </summary>
 /// <param name="trigger">InputTrigger to register</param>
 /// <returns>Index that the trigger was added at</returns>
 public int RegisterTrigger(InputTrigger trigger)
 {
     if (trigger == null)
     {
         return(-1);
     }
     _triggers.Add(trigger);
     return(_triggers.Count - 1);
 }
Esempio n. 2
0
 /// <summary>
 /// Enables or disables a specific trigger using the specified index.
 /// </summary>
 /// <param name="index">Zero-based index of the trigger in the InputTriggerCollection</param>
 /// <param name="enabled">Enabled status of the trigger</param>
 /// <returns>True if the operation was successful false if an exception was thrown or if the trigger was null</returns>
 public bool EnableTrigger(int index, bool enabled)
 {
     try {
         InputTrigger trigger = _triggers[index];
         if (trigger != null)
         {
             trigger.IsEnabled = enabled;
             return(true);
         }
         return(false);
     } catch (ArgumentOutOfRangeException e) {
         System.Diagnostics.Debug.WriteLine(e.StackTrace);
         return(false);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Remove a trigger from the layer.
 /// </summary>
 /// <param name="trigger">InputTrigger to remove</param>
 /// <returns>True if the trigger was removed</returns>
 public bool RemoveTrigger(InputTrigger trigger)
 {
     return(_triggers.Remove(trigger));
 }