Compare commits

...

2 Commits

Author SHA1 Message Date
Syntriax 8963df6f46 docs: ITrigger.StateEnable Documentation Updated 2023-03-20 23:00:17 +03:00
Syntriax fc49961ef3 refactor: Back Fields Are Renamed 2023-03-20 22:59:20 +03:00
3 changed files with 9 additions and 9 deletions

View File

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

View File

@ -6,7 +6,7 @@ namespace Syntriax.Modules.Trigger
public interface ITrigger public interface ITrigger
{ {
/// <summary> /// <summary>
/// <see cref="IStateEnable"/> to switch on or off /// <see cref="IStateEnable"/> to control the state of the <see cref="ITrigger"/> is on or off
/// </summary> /// </summary>
IStateEnable StateEnable { get; } IStateEnable StateEnable { get; }

View File

@ -8,17 +8,17 @@ namespace Syntriax.Modules.Trigger
{ {
public Action<bool> OnTriggerStateChanged { get; set; } = null; public Action<bool> OnTriggerStateChanged { get; set; } = null;
private IStateEnable stateEnable = null; private IStateEnable _stateEnable = null;
public IStateEnable StateEnable public IStateEnable StateEnable
{ {
get get
{ {
if (stateEnable == null) if (_stateEnable == null)
{ {
stateEnable = GetComponent<IStateEnable>() ?? gameObject.AddComponent<StateEnableMonoBehaviour>(); _stateEnable = GetComponent<IStateEnable>() ?? gameObject.AddComponent<StateEnableMonoBehaviour>();
stateEnable.OnEnabledChanged += OnEnabledChanged; _stateEnable.OnEnabledChanged += OnEnabledChanged;
} }
return stateEnable; return _stateEnable;
} }
} }