feat: Added State Enabled Integration to Editor Visualization Of Collider Triggers

This commit is contained in:
Syntriax 2023-03-20 22:24:18 +03:00
parent f2faa86f65
commit c8105122fb
4 changed files with 15 additions and 3 deletions

View File

@ -11,7 +11,7 @@ namespace Syntriax.Modules.Trigger
private void OnDrawGizmosSelected()
{
if (UnityEditor.EditorApplication.isPlaying)
Gizmos.color = previousTriggerCount > 0 ? Color.green : Color.red;
Gizmos.color = previousTriggerCount > 0 && StateEnable.IsEnabled ? Color.green : Color.red;
else
Gizmos.color = TriggerCount > 0 ? Color.green : Color.red;
Gizmos.DrawWireCube(transform.position, transform.lossyScale);

View File

@ -11,7 +11,7 @@ namespace Syntriax.Modules.Trigger
private void OnDrawGizmosSelected()
{
if (UnityEditor.EditorApplication.isPlaying)
Gizmos.color = previousTriggerCount > 0 ? Color.green : Color.red;
Gizmos.color = previousTriggerCount > 0 && StateEnable.IsEnabled ? Color.green : Color.red;
else
Gizmos.color = TriggerCount > 0 ? Color.green : Color.red;
Gizmos.matrix = transform.localToWorldMatrix;

View File

@ -11,7 +11,7 @@ namespace Syntriax.Modules.Trigger
private void OnDrawGizmosSelected()
{
if (UnityEditor.EditorApplication.isPlaying)
Gizmos.color = previousTriggerCount > 0 ? Color.green : Color.red;
Gizmos.color = previousTriggerCount > 0 && StateEnable.IsEnabled ? Color.green : Color.red;
else
Gizmos.color = TriggerCount > 0 ? Color.green : Color.red;

View File

@ -45,5 +45,17 @@ namespace Syntriax.Modules.Trigger
return true;
}
#if UNITY_EDITOR
private State.IStateEnable stateEnable = null;
public State.IStateEnable StateEnable
{
get
{
stateEnable = stateEnable ?? GetComponent<State.IStateEnable>() ?? gameObject.AddComponent<State.StateEnableMonoBehaviour>();
return stateEnable;
}
}
#endif
}
}