feat: 3D Box Area ColliderTriggerArea & GroundTriggerArea Added

This commit is contained in:
Syntriax 2023-02-16 13:07:14 +03:00
parent 8356f72d6d
commit cee04f5da3
3 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,22 @@
using UnityEngine;
namespace Syntriax.Modules.Trigger
{
public class BoxColliderTriggerArea : ColliderTriggerAreaBase<Collider>
{
protected override int TriggerCount
=> Physics.OverlapBoxNonAlloc(transform.position, transform.localScale * .5f, nonAllocResults, transform.rotation, ColliderMask);
#if UNITY_EDITOR
private void OnDrawGizmosSelected()
{
if (UnityEditor.EditorApplication.isPlaying)
Gizmos.color = previousTriggerCount > 0 ? Color.green : Color.red;
else
Gizmos.color = TriggerCount > 0 ? Color.green : Color.red;
Gizmos.DrawWireCube(transform.position, transform.lossyScale);
}
#endif
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 850a555be97ed9b4a86942b21a6a25e4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,4 @@
namespace Syntriax.Modules.Trigger
{
public class BoxGroundTriggerArea : BoxColliderTriggerArea, IGroundTriggerArea { }
}