Fixed Mistakes
This commit is contained in:
parent
330a41a87f
commit
b7fafaa09f
|
@ -5,15 +5,14 @@ namespace Syntriax.Modules.Trigger
|
|||
|
||||
public class Box2DColliderTrigger : Trigger, IColliderTrigger
|
||||
{
|
||||
private Collider2D[] results = new Collider2D[8];
|
||||
|
||||
public LayerMask ColliderMask { get => colliderMask; set => colliderMask = value; }
|
||||
[SerializeField] private LayerMask colliderMask = 0;
|
||||
|
||||
private Collider2D[] results = new Collider2D[8];
|
||||
|
||||
protected void FixedUpdate()
|
||||
=> IsTrigerred = Physics2D.OverlapBoxNonAlloc(transform.position, transform.localScale, 0, results, ColliderMask) > 0;
|
||||
|
||||
|
||||
#if UNITY_EDITOR
|
||||
private void OnDrawGizmosSelected()
|
||||
{
|
||||
|
|
|
@ -4,7 +4,11 @@ namespace Syntriax.Modules.Trigger
|
|||
{
|
||||
public interface ITrigger
|
||||
{
|
||||
bool IsTrigerred { get; }
|
||||
/// <summary>
|
||||
/// Called everytime the IsTrigerred field is changed
|
||||
/// </summary>
|
||||
/// <value>The new value of IsTrigerred</value>
|
||||
Action<bool> OnTriggered { get; set; }
|
||||
bool IsTrigerred { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,10 +5,6 @@ namespace Syntriax.Modules.Trigger
|
|||
{
|
||||
public class Trigger : MonoBehaviour, ITrigger
|
||||
{
|
||||
/// <summary>
|
||||
/// Called everytime the IsTrigerred field is changed
|
||||
/// </summary>
|
||||
/// <value>The new value of IsTrigerred</value>
|
||||
public Action<bool> OnTriggered { get; set; } = null;
|
||||
|
||||
private bool _isTrigerred = false;
|
||||
|
|
Loading…
Reference in New Issue