Compare commits
2 Commits
c8105122fb
...
8963df6f46
Author | SHA1 | Date |
---|---|---|
Syntriax | 8963df6f46 | |
Syntriax | fc49961ef3 |
|
@ -47,13 +47,13 @@ namespace Syntriax.Modules.Trigger
|
|||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
private State.IStateEnable stateEnable = null;
|
||||
private State.IStateEnable _stateEnable = null;
|
||||
public State.IStateEnable StateEnable
|
||||
{
|
||||
get
|
||||
{
|
||||
stateEnable = stateEnable ?? GetComponent<State.IStateEnable>() ?? gameObject.AddComponent<State.StateEnableMonoBehaviour>();
|
||||
return stateEnable;
|
||||
_stateEnable = _stateEnable ?? GetComponent<State.IStateEnable>() ?? gameObject.AddComponent<State.StateEnableMonoBehaviour>();
|
||||
return _stateEnable;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Syntriax.Modules.Trigger
|
|||
public interface ITrigger
|
||||
{
|
||||
/// <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>
|
||||
IStateEnable StateEnable { get; }
|
||||
|
||||
|
|
|
@ -8,17 +8,17 @@ namespace Syntriax.Modules.Trigger
|
|||
{
|
||||
public Action<bool> OnTriggerStateChanged { get; set; } = null;
|
||||
|
||||
private IStateEnable stateEnable = null;
|
||||
private IStateEnable _stateEnable = null;
|
||||
public IStateEnable StateEnable
|
||||
{
|
||||
get
|
||||
{
|
||||
if (stateEnable == null)
|
||||
if (_stateEnable == null)
|
||||
{
|
||||
stateEnable = GetComponent<IStateEnable>() ?? gameObject.AddComponent<StateEnableMonoBehaviour>();
|
||||
stateEnable.OnEnabledChanged += OnEnabledChanged;
|
||||
_stateEnable = GetComponent<IStateEnable>() ?? gameObject.AddComponent<StateEnableMonoBehaviour>();
|
||||
_stateEnable.OnEnabledChanged += OnEnabledChanged;
|
||||
}
|
||||
return stateEnable;
|
||||
return _stateEnable;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue