2022-12-17 14:39:54 +03:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace Syntriax.Modules.Trigger
|
|
|
|
{
|
2023-02-16 13:03:30 +03:00
|
|
|
public class Box2DColliderTriggerAreaWithRotation : ColliderTriggerAreaBase<Collider2D>
|
2022-12-17 14:39:54 +03:00
|
|
|
{
|
|
|
|
protected override int TriggerCount
|
|
|
|
=> Physics2D.OverlapBoxNonAlloc(transform.position, transform.localScale, transform.rotation.eulerAngles.z, nonAllocResults, ColliderMask);
|
|
|
|
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
private void OnDrawGizmosSelected()
|
|
|
|
{
|
2023-02-16 13:06:35 +03:00
|
|
|
if (UnityEditor.EditorApplication.isPlaying)
|
2023-03-20 22:24:18 +03:00
|
|
|
Gizmos.color = previousTriggerCount > 0 && StateEnable.IsEnabled ? Color.green : Color.red;
|
2023-02-16 13:06:35 +03:00
|
|
|
else
|
|
|
|
Gizmos.color = TriggerCount > 0 ? Color.green : Color.red;
|
2022-12-17 14:39:54 +03:00
|
|
|
Gizmos.matrix = transform.localToWorldMatrix;
|
|
|
|
Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|