Trigger/Runtime/ITriggerExtensions.cs

15 lines
721 B
C#

namespace Syntriax.Modules.Trigger
{
public static class ITriggerExtensions
{
/// <summary>
/// Checks if the provided parameter ITrigger is toggled, if the parameter is null returns the nullValue parameter
/// </summary>
/// <param name="trigger">ITrigger to be checked if toggled or not</param>
/// <param name="nullValue">The value that will be returned if toggleState is null. Default value: true</param>
/// <returns>ITrigger's toggle value, or if null return nullValue parameter</returns>
public static bool IsTriggeredNullChecked(this ITrigger trigger, bool nullValue = true)
=> trigger == null ? nullValue : trigger.IsTrigerred;
}
}