Skip to content

Commit 66aae89

Browse files
committed
changed api of Trackers in Extras.Utilities
1 parent 59ba898 commit 66aae89

File tree

4 files changed

+46
-33
lines changed

4 files changed

+46
-33
lines changed

Extras/Characters/Prefabs/NavMeshCharacter.prefab

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,6 @@ MonoBehaviour:
240240
m_EditorClassIdentifier:
241241
_description:
242242
_signal: {fileID: 11400000, guid: cbc6c60aea74f1a4bbae11198e8221bd, type: 2}
243-
_onChanged:
244-
m_PersistentCalls:
245-
m_Calls: []
246-
m_TypeName: Signals.Common.Vector3Event, Signals, Version=0.0.0.0, Culture=neutral,
247-
PublicKeyToken=null
248243
_onUpdated:
249244
m_PersistentCalls:
250245
m_Calls:
@@ -259,7 +254,7 @@ MonoBehaviour:
259254
m_StringArgument:
260255
m_BoolArgument: 0
261256
m_CallState: 2
262-
m_TypeName: Signals.Common.Vector3Event, Signals, Version=0.0.0.0, Culture=neutral,
257+
m_TypeName: Signals.Common.Vector3Event, Signals.Common, Version=0.0.0.0, Culture=neutral,
263258
PublicKeyToken=null
264259
_invokeImmediately: 0
265260
--- !u!114 &114507914540082106
@@ -276,3 +271,6 @@ MonoBehaviour:
276271
m_EditorClassIdentifier:
277272
_signal: {fileID: 11400000, guid: 6667cbec9243f6f4d8788a4c679ee5fd, type: 2}
278273
_local: 0
274+
_trackOnUpdate: 0
275+
_trackOnLateUpdate: 1
276+
_trackOnFixedUpdate: 0

Extras/Utility/Scripts/EulerAnglesTracker.cs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,28 @@ public class EulerAnglesTracker : MonoBehaviour
99
{
1010
[SerializeField] Vector3Signal _signal;
1111
[SerializeField] bool _local;
12-
[SerializeField] bool _onUpdate = true;
13-
[SerializeField] bool _onLateUpdate;
14-
[SerializeField] bool _onFixedUpdate;
12+
[SerializeField] bool _trackOnUpdate = true;
13+
[SerializeField] bool _trackOnLateUpdate;
14+
[SerializeField] bool _trackOnFixedUpdate;
1515

1616
/// <summary>The signal that keeps track of the rotation.</summary>
1717
public Vector3Signal Signal { get => _signal; set => _signal = value; }
1818

1919
/// <summary>True to track local instead of global rotation.</summary>
2020
public bool Local { get => _local; set => _local = value; }
2121

22-
public bool OnUpdate { get => _onUpdate; set => _onUpdate = value; }
23-
public bool OnLateUpdate { get => _onLateUpdate; set => _onLateUpdate = value; }
24-
public bool OnFixedUpdate { get => _onFixedUpdate; set => _onFixedUpdate = value; }
22+
/// <summary>Track on Update?</summary>
23+
public bool TrackOnUpdate { get => _trackOnUpdate; set => _trackOnUpdate = value; }
2524

26-
void Update() { if(_onUpdate) SetSignalValue(); }
27-
void LateUpdate() { if (_onLateUpdate) SetSignalValue(); }
28-
void FixedUpdate() { if (_onFixedUpdate) SetSignalValue(); }
25+
/// <summary>Track on LateUpdate?</summary>
26+
public bool TrackOnLateUpdate { get => _trackOnLateUpdate; set => _trackOnLateUpdate = value; }
27+
28+
/// <summary>Track on FixedUpdate?</summary>
29+
public bool TrackOnFixedUpdate { get => _trackOnFixedUpdate; set => _trackOnFixedUpdate = value; }
30+
31+
void Update() { if(_trackOnUpdate) SetSignalValue(); }
32+
void LateUpdate() { if (_trackOnLateUpdate) SetSignalValue(); }
33+
void FixedUpdate() { if (_trackOnFixedUpdate) SetSignalValue(); }
2934

3035
void SetSignalValue() { if (_signal) _signal.Value = _local ? transform.localEulerAngles : transform.eulerAngles; }
3136
}

Extras/Utility/Scripts/PositionTracker.cs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,28 @@ public class PositionTracker : MonoBehaviour
1212
{
1313
[SerializeField] Vector3Signal _signal;
1414
[SerializeField] bool _local;
15-
[SerializeField] bool _onUpdate = true;
16-
[SerializeField] bool _onLateUpdate;
17-
[SerializeField] bool _onFixedUpdate;
15+
[SerializeField] bool _trackOnUpdate = true;
16+
[SerializeField] bool _trackOnLateUpdate;
17+
[SerializeField] bool _trackOnFixedUpdate;
1818

1919
/// <summary>The signal that keeps track of the position.</summary>
2020
public Vector3Signal Signal { get => _signal; set => _signal = value; }
2121

2222
/// <summary>True to track local instead of global position.</summary>
2323
public bool Local { get => _local; set => _local = value; }
2424

25-
public bool OnUpdate { get => _onUpdate; set => _onUpdate = value; }
26-
public bool OnLateUpdate { get => _onLateUpdate; set => _onLateUpdate = value; }
27-
public bool OnFixedUpdate { get => _onFixedUpdate; set => _onFixedUpdate = value; }
25+
/// <summary>Track on Update?</summary>
26+
public bool TrackOnUpdate { get => _trackOnUpdate; set => _trackOnUpdate = value; }
2827

29-
void Update() { if (_onUpdate) SetSignalValue(); }
30-
void LateUpdate() { if (_onLateUpdate) SetSignalValue(); }
31-
void FixedUpdate() { if (_onFixedUpdate) SetSignalValue(); }
28+
/// <summary>Track on LateUpdate?</summary>
29+
public bool TrackOnLateUpdate { get => _trackOnLateUpdate; set => _trackOnLateUpdate = value; }
30+
31+
/// <summary>Track on FixedUpdate?</summary>
32+
public bool TrackOnFixedUpdate { get => _trackOnFixedUpdate; set => _trackOnFixedUpdate = value; }
33+
34+
void Update() { if (_trackOnUpdate) SetSignalValue(); }
35+
void LateUpdate() { if (_trackOnLateUpdate) SetSignalValue(); }
36+
void FixedUpdate() { if (_trackOnFixedUpdate) SetSignalValue(); }
3237

3338
void SetSignalValue() { if (_signal) _signal.Value = _local ? transform.localPosition : transform.position; }
3439
}

Extras/Utility/Scripts/RotationTracker.cs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,28 @@ public class RotationTracker : MonoBehaviour
1111
{
1212
[SerializeField] QuaternionSignal _signal;
1313
[SerializeField] bool _local;
14-
[SerializeField] bool _onUpdate = true;
15-
[SerializeField] bool _onLateUpdate;
16-
[SerializeField] bool _onFixedUpdate;
14+
[SerializeField] bool _trackOnUpdate = true;
15+
[SerializeField] bool _trackOnLateUpdate;
16+
[SerializeField] bool _trackOnFixedUpdate;
1717

1818
/// <summary>The signal that keeps track of the rotation.</summary>
1919
public QuaternionSignal Signal { get => _signal; set => _signal = value; }
2020

2121
/// <summary>True to track local instead of global rotation.</summary>
2222
public bool Local { get => _local; set => _local = value; }
2323

24-
public bool OnUpdate { get => _onUpdate; set => _onUpdate = value; }
25-
public bool OnLateUpdate { get => _onLateUpdate; set => _onLateUpdate = value; }
26-
public bool OnFixedUpdate { get => _onFixedUpdate; set => _onFixedUpdate = value; }
24+
/// <summary>Track on Update?</summary>
25+
public bool TrackOnUpdate { get => _trackOnUpdate; set => _trackOnUpdate = value; }
2726

28-
void Update() { if (_onUpdate) SetSignalValue(); }
29-
void LateUpdate() { if (_onLateUpdate) SetSignalValue(); }
30-
void FixedUpdate() { if (_onFixedUpdate) SetSignalValue(); }
27+
/// <summary>Track on LateUpdate?</summary>
28+
public bool TrackOnLateUpdate { get => _trackOnLateUpdate; set => _trackOnLateUpdate = value; }
29+
30+
/// <summary>Track on FixedUpdate?</summary>
31+
public bool TrackOnFixedUpdate { get => _trackOnFixedUpdate; set => _trackOnFixedUpdate = value; }
32+
33+
void Update() { if (_trackOnUpdate) SetSignalValue(); }
34+
void LateUpdate() { if (_trackOnLateUpdate) SetSignalValue(); }
35+
void FixedUpdate() { if (_trackOnFixedUpdate) SetSignalValue(); }
3136

3237
void SetSignalValue() { if (_signal) _signal.Value = _local ? transform.localRotation : transform.rotation; }
3338
}

0 commit comments

Comments
 (0)