using UnityEngine; namespace Syntriax.Modules.Trigger { public class Box2DColliderTriggerWithRotation : Trigger, IColliderTrigger { 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, transform.rotation.eulerAngles.z, results, ColliderMask) > 0; #if UNITY_EDITOR private void OnDrawGizmosSelected() { Gizmos.color = IsTrigerred ? Color.green : Color.red; Gizmos.matrix = transform.localToWorldMatrix; Gizmos.DrawWireCube(Vector3.zero, Vector3.one); } #endif } }