Skip to content

Commit c25469d

Browse files
committedJan 29, 2024·
Merge branch 'develop'
2 parents cb160c9 + e13ab78 commit c25469d

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed
 

‎Runtime/StateMachine/State.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public abstract class State : MonoBehaviour
3636
/// <summary>
3737
/// Internal function of activating the state
3838
/// </summary>
39-
internal virtual bool ActivateState(StateData data)
39+
internal bool ActivateState(StateData data)
4040
{
4141
try {
4242
_timeEnteredState = Time.time;

‎Runtime/StateMachine/StateMachine.cs

+25
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,30 @@ public bool TryFindState<T>(out T state) where T : State
144144
}
145145

146146

147+
/// <summary>
148+
/// Activates the state machine
149+
/// </summary>
150+
public void Activate([CanBeNull] StateData data = null)
151+
{
152+
if (isActive) return;
153+
ActivateState(data ?? new StateData());
154+
}
155+
156+
157+
/// <summary>
158+
/// Continues the queue in the state machine, or deactivates the state if it is the root state machine
159+
/// </summary>
160+
public new void Deactivate()
161+
{
162+
if (!isActive) return;
163+
if (stateMachine == null) {
164+
DeactivateState();
165+
} else {
166+
base.Deactivate();
167+
}
168+
}
169+
170+
147171
/// <summary>
148172
/// Internal function for deactivating the state
149173
/// </summary>
@@ -171,6 +195,7 @@ protected override void Awake()
171195
protected virtual void Start()
172196
{
173197
if (!_autoActivate) return;
198+
if (isActive) return;
174199
ActivateState(new StateData());
175200
}
176201

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "jutils",
33
"displayName": "JUtils",
4-
"version": "1.10.1",
4+
"version": "1.10.2",
55
"description": "A unity utilities library, this contains many handy extensions, components and data structures with custom editors",
66
"license": "LGPL-3.0",
77
"author": {

0 commit comments

Comments
 (0)
Please sign in to comment.