Trigger/Runtime/Collider/Box2DColliderTriggerAreaWit...

20 lines
633 B
C#

using UnityEngine;
namespace Syntriax.Modules.Trigger
{
public class Box2DColliderTriggerAreaWithRotation : ColliderTriggerAreaBase
{
protected override int TriggerCount
=> Physics2D.OverlapBoxNonAlloc(transform.position, transform.localScale, transform.rotation.eulerAngles.z, nonAllocResults, ColliderMask);
#if UNITY_EDITOR
private void OnDrawGizmosSelected()
{
Gizmos.color = previousTriggerCount > 0 ? Color.green : Color.red;
Gizmos.matrix = transform.localToWorldMatrix;
Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
}
#endif
}
}