Compare commits

..

2 Commits

Author SHA1 Message Date
330a41a87f Meta Files 2022-11-14 14:21:08 +03:00
63ec8bdf99 Extensions Renamed and Some Documentation Added 2022-11-14 14:19:14 +03:00
4 changed files with 21 additions and 11 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

@@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d1b41d4e3ee5ce24eaef42d5c8fc8c3a guid: 4664637bbd2ba574c85953b5c5d67598
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2

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;