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