Extensions Renamed and Some Documentation Added

This commit is contained in:
Syntriax 2022-11-14 14:19:14 +03:00
parent 4f2217bb63
commit 63ec8bdf99
3 changed files with 20 additions and 10 deletions

View File

@ -1,8 +0,0 @@
namespace Syntriax.Modules.Trigger
{
public static class IColliderTriggerExtensions
{
public static bool IsTriggeredNullChecked(this IColliderTrigger colliderCheck)
=> colliderCheck == null ? true : colliderCheck.IsTrigerred;
}
}

14
ITriggerExtensions.cs Normal file
View File

@ -0,0 +1,14 @@
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;
}
}

View File

@ -5,9 +5,13 @@ namespace Syntriax.Modules.Trigger
{ {
public class Trigger : MonoBehaviour, ITrigger public class Trigger : MonoBehaviour, ITrigger
{ {
private bool _isTrigerred = false; /// <summary>
/// Called everytime the IsTrigerred field is changed
/// </summary>
/// <value>The new value of IsTrigerred</value>
public Action<bool> OnTriggered { get; set; } = null; public Action<bool> OnTriggered { get; set; } = null;
private bool _isTrigerred = false;
public bool IsTrigerred public bool IsTrigerred
{ {
get => _isTrigerred; get => _isTrigerred;