com.wallstop-studios.unity-helpers 2.0.0-rc05 → 2.0.0-rc07

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/Runtime/Core/DataStructure/TimedCache.cs +4 -3
  2. package/Runtime/Core/Extension/IListExtensions.cs +2 -2
  3. package/Runtime/Core/Extension/RandomExtensions.cs +23 -4
  4. package/Runtime/Core/Extension/UnityExtensions.cs +278 -90
  5. package/Runtime/Core/Helper/ArrayConverter.cs +39 -0
  6. package/Runtime/Core/Helper/ArrayConverter.cs.meta +3 -0
  7. package/Runtime/Core/Helper/Helpers.cs +133 -563
  8. package/Runtime/Core/Helper/Partials/LogHelpers.cs +13 -0
  9. package/Runtime/Core/Helper/Partials/LogHelpers.cs.meta +3 -0
  10. package/Runtime/Core/Helper/Partials/MathHelpers.cs +30 -0
  11. package/Runtime/Core/Helper/Partials/MathHelpers.cs.meta +3 -0
  12. package/Runtime/Core/Helper/Partials/ObjectHelpers.cs +388 -0
  13. package/Runtime/Core/Helper/Partials/ObjectHelpers.cs.meta +3 -0
  14. package/Runtime/Core/Helper/Partials/TransformHelpers.cs +167 -0
  15. package/Runtime/Core/Helper/Partials/TransformHelpers.cs.meta +3 -0
  16. package/Runtime/Core/Helper/Partials.meta +3 -0
  17. package/Runtime/Core/Helper/WallMath.cs +85 -22
  18. package/Runtime/Core/Random/AbstractRandom.cs +208 -162
  19. package/Runtime/Core/Random/DotNetRandom.cs +3 -5
  20. package/Runtime/Core/Random/PRNG.cs +7 -0
  21. package/Runtime/Core/Random/PRNG.cs.meta +3 -0
  22. package/Runtime/Core/Random/PcgRandom.cs +4 -6
  23. package/Runtime/Core/Random/RandomState.cs +31 -3
  24. package/Runtime/Core/Random/SquirrelRandom.cs +12 -15
  25. package/Runtime/Core/Random/SystemRandom.cs +92 -46
  26. package/Runtime/Core/Random/ThreadLocalRandom.cs +2 -1
  27. package/Runtime/Core/Random/UnityRandom.cs +2 -4
  28. package/Runtime/Core/Random/WyRandom.cs +2 -4
  29. package/Runtime/Core/Random/XorShiftRandom.cs +3 -5
  30. package/Runtime/Core/Serialization/Serializer.cs +36 -14
  31. package/Runtime/Utils/CircleLineRenderer.cs +17 -5
  32. package/Tests/Runtime/DataStructures/SpatialTreeTests.cs +34 -10
  33. package/Tests/Runtime/Helper/ArrayConverterTests.cs +19 -0
  34. package/Tests/Runtime/Helper/ArrayConverterTests.cs.meta +3 -0
  35. package/Tests/Runtime/Helper/ObjectHelperTests.cs +402 -0
  36. package/Tests/Runtime/Helper/ObjectHelperTests.cs.meta +3 -0
  37. package/Tests/Runtime/Helper/WallMathTests.cs +221 -0
  38. package/Tests/Runtime/Helper/WallMathTests.cs.meta +3 -0
  39. package/Tests/Runtime/Helper.meta +3 -0
  40. package/Tests/Runtime/Performance/RandomPerformanceTests.cs +58 -3
  41. package/Tests/Runtime/Performance/SpatialTreePerformanceTest.cs +47 -34
  42. package/Tests/Runtime/Random/RandomTestBase.cs +284 -9
  43. package/Tests/Runtime/Random/SquirrelRandomTests.cs +5 -0
  44. package/Tests/Runtime/Serialization/JsonSerializationTest.cs +24 -11
  45. package/Tests/Runtime/Utils/SpriteRendererMetadataTests.cs +21 -17
  46. package/package.json +1 -1
@@ -0,0 +1,221 @@
1
+ namespace UnityHelpers.Tests.Tests.Runtime.Helper
2
+ {
3
+ using Core.Extension;
4
+ using Core.Helper;
5
+ using Core.Random;
6
+ using NUnit.Framework;
7
+ using UnityEngine;
8
+
9
+ public sealed class WallMathTests
10
+ {
11
+ private const int TestIterations = 10_000;
12
+
13
+ [Test]
14
+ public void ApproximatelyRandom()
15
+ {
16
+ for (int i = 0; i < TestIterations; ++i)
17
+ {
18
+ float target = PRNG.Instance.NextFloat(-1_000, 1_000);
19
+ float delta = PRNG.Instance.NextFloat(0f, 10f);
20
+
21
+ float insideOffset = delta * PRNG.Instance.NextFloat();
22
+ if (PRNG.Instance.NextBool())
23
+ {
24
+ insideOffset *= -1;
25
+ }
26
+
27
+ float inside = target + insideOffset;
28
+ Assert.IsTrue(
29
+ target.Approximately(inside, delta),
30
+ $"Target {target} is not close enough to {inside} with a delta of {delta}."
31
+ );
32
+
33
+ float outsideOffset = delta * PRNG.Instance.NextFloat(1.001f, 10f);
34
+ if (PRNG.Instance.NextBool())
35
+ {
36
+ outsideOffset *= -1;
37
+ }
38
+
39
+ float outside = target + outsideOffset;
40
+ Assert.IsFalse(
41
+ target.Approximately(outside, delta),
42
+ $"Target {target} was unexpectedly close to {outside} with a delta of {delta}."
43
+ );
44
+ }
45
+ }
46
+
47
+ [Test]
48
+ public void ApproximatelyExpected()
49
+ {
50
+ Assert.IsTrue(0f.Approximately(0f, 0f));
51
+ Assert.IsTrue(0f.Approximately(0.5f, 1f));
52
+ Assert.IsFalse(0.001f.Approximately(0f, 0f));
53
+ Assert.IsFalse(100f.Approximately(5f, 2.4f));
54
+
55
+ Assert.IsTrue(0.001f.Approximately(0.0001f));
56
+ }
57
+
58
+ [Test]
59
+ public void ClampRectInsideRandom()
60
+ {
61
+ for (int i = 0; i < TestIterations; ++i)
62
+ {
63
+ Vector2 position = PRNG.Instance.NextVector2InRange(10f);
64
+
65
+ Vector2 size;
66
+ do
67
+ {
68
+ size = PRNG.Instance.NextVector2InRange(10f);
69
+ } while (size.x < 0 || size.y < 0);
70
+
71
+ Rect rect = new(position, size);
72
+
73
+ Vector2 inside = new(
74
+ PRNG.Instance.NextFloat(rect.min.x, rect.max.x),
75
+ PRNG.Instance.NextFloat(rect.min.y, rect.max.y)
76
+ );
77
+ Assert.IsTrue(rect.Contains(inside), $"Rect {rect} does not contain {inside}.");
78
+ Vector2 clamped = rect.Clamp(inside);
79
+ Assert.AreEqual(inside, clamped);
80
+ }
81
+ }
82
+
83
+ [Test]
84
+ public void ClampRectInsideExpected()
85
+ {
86
+ Rect rect = new Rect(Vector2.one, Vector2.one);
87
+ Vector2 clamped = rect.Clamp(rect.center);
88
+ Assert.AreEqual(rect.center, clamped);
89
+
90
+ Vector2 inside =
91
+ rect.center
92
+ + new Vector2(PRNG.Instance.NextFloat(0.1f), PRNG.Instance.NextFloat(0.1f));
93
+ clamped = rect.Clamp(inside);
94
+ Assert.AreEqual(
95
+ inside,
96
+ clamped,
97
+ $"Expected inside point {inside} unexpectedly was clamped to {clamped} for rect {rect}."
98
+ );
99
+ }
100
+
101
+ [Test]
102
+ public void ClampRectOutsideRandom()
103
+ {
104
+ Rect rect = new(Vector2.one, Vector2.one);
105
+ for (int i = 0; i < TestIterations; ++i)
106
+ {
107
+ Vector2 outside;
108
+ do
109
+ {
110
+ outside = PRNG.Instance.NextVector2InRange(10f, rect.center);
111
+ } while (rect.Contains(outside));
112
+
113
+ Vector2 originalOutside = outside;
114
+ Vector2 clamped = rect.Clamp(ref outside);
115
+ Debug.Log($"Clamped {originalOutside} to {clamped}.");
116
+ Assert.AreNotEqual(originalOutside, clamped);
117
+ Assert.AreEqual(clamped, outside);
118
+
119
+ // Shrink just a little to ensure within bounds, clamping will put it right on the edge
120
+ const float shrinkScaleToAccountForPrecision = 0.99f;
121
+ Vector2 delta = rect.center - clamped;
122
+ delta *= shrinkScaleToAccountForPrecision;
123
+ clamped = rect.center + delta;
124
+ Assert.IsTrue(
125
+ rect.Contains(clamped),
126
+ $"Expected rect {rect} to contain {clamped}, but it did not."
127
+ );
128
+ }
129
+ }
130
+
131
+ [Test]
132
+ public void ClampRectOutsideExpected()
133
+ {
134
+ Rect rect = new(Vector2.one, Vector2.one);
135
+ Vector2 outside = new(rect.center.x, 100f);
136
+ Vector2 clamped = rect.Clamp(ref outside);
137
+ Assert.AreEqual(clamped, outside);
138
+ Assert.AreEqual(new Vector2(rect.center.x, 2f), clamped);
139
+
140
+ // Shrink just a little to ensure within bounds, clamping will put it right on the edge
141
+ const float shrinkScaleToAccountForPrecision = 0.99f;
142
+ Vector2 delta = rect.center - clamped;
143
+ delta *= shrinkScaleToAccountForPrecision;
144
+ clamped = rect.center + delta;
145
+ Assert.IsTrue(
146
+ rect.Contains(clamped),
147
+ $"Expected rect to contain {clamped}, but it did not."
148
+ );
149
+ }
150
+
151
+ [Test]
152
+ public void ClampFloat()
153
+ {
154
+ float value = 1.25f;
155
+ float clamped = value.Clamp(0, 1);
156
+ Assert.AreEqual(1, clamped);
157
+ Assert.AreEqual(1.25f, value);
158
+
159
+ value = 0.5f;
160
+ clamped = value.Clamp(0, 1);
161
+ Assert.AreEqual(0.5f, clamped);
162
+ Assert.AreEqual(0.5f, value);
163
+ }
164
+
165
+ [Test]
166
+ public void WrappedIncrementWrapped()
167
+ {
168
+ int ten = 10;
169
+ int one = ten.WrappedIncrement(10);
170
+ Assert.AreEqual(1, one);
171
+ Assert.AreEqual(10, ten);
172
+
173
+ int toChangeToOne = 10;
174
+ int returned = WallMath.WrappedIncrement(ref toChangeToOne, 10);
175
+ Assert.AreEqual(1, returned);
176
+ Assert.AreEqual(1, toChangeToOne);
177
+ }
178
+
179
+ [Test]
180
+ public void WrappedIncrementUnwrapped()
181
+ {
182
+ int ten = 10;
183
+ int eleven = ten.WrappedIncrement(100);
184
+ Assert.AreEqual(11, eleven);
185
+ Assert.AreEqual(10, ten);
186
+
187
+ int toChangeToEleven = 10;
188
+ int returned = WallMath.WrappedIncrement(ref toChangeToEleven, 100);
189
+ Assert.AreEqual(11, returned);
190
+ Assert.AreEqual(11, toChangeToEleven);
191
+ }
192
+
193
+ [Test]
194
+ public void WrappedAddWrapped()
195
+ {
196
+ int ten = 10;
197
+ int two = ten.WrappedAdd(2, 10);
198
+ Assert.AreEqual(10, ten);
199
+ Assert.AreEqual(2, two);
200
+
201
+ int toChangeToTwo = 10;
202
+ int returned = WallMath.WrappedAdd(ref toChangeToTwo, 2, 10);
203
+ Assert.AreEqual(2, returned);
204
+ Assert.AreEqual(2, toChangeToTwo);
205
+ }
206
+
207
+ [Test]
208
+ public void WrappedAddUnwrapped()
209
+ {
210
+ int ten = 10;
211
+ int twelve = ten.WrappedAdd(2, 100);
212
+ Assert.AreEqual(10, ten);
213
+ Assert.AreEqual(12, twelve);
214
+
215
+ int toChangeToTwelve = 10;
216
+ int returned = WallMath.WrappedAdd(ref toChangeToTwelve, 2, 100);
217
+ Assert.AreEqual(12, returned);
218
+ Assert.AreEqual(12, toChangeToTwelve);
219
+ }
220
+ }
221
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 11e0e2d4098d47159de89eff698b2510
3
+ timeCreated: 1732563313
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: d1cf06665d214b7aa507e42eb1fdfbe4
3
+ timeCreated: 1732492095
@@ -12,8 +12,12 @@
12
12
  {
13
13
  TimeSpan timeout = TimeSpan.FromSeconds(1.125);
14
14
 
15
- UnityEngine.Debug.Log($"| Random | Next | NextFloat | NextDouble |");
16
- UnityEngine.Debug.Log($"| ------ | ---- | --------- | ---------- |");
15
+ UnityEngine.Debug.Log(
16
+ $"| Random | NextBool | Next | NextUInt | NextFloat | NextDouble | NextUint - Range | "
17
+ );
18
+ UnityEngine.Debug.Log(
19
+ $"| ------ | -------- | ---- | -------- | --------- | ---------- | ---------------- |"
20
+ );
17
21
 
18
22
  RunTest(new PcgRandom(), timeout);
19
23
  RunTest(new SystemRandom(), timeout);
@@ -26,12 +30,21 @@
26
30
  private static void RunTest<T>(T random, TimeSpan timeout)
27
31
  where T : IRandom
28
32
  {
33
+ int nextBool = RunNextBool(timeout, random);
29
34
  int nextInt = RunNext(timeout, random);
35
+ int nextUint = RunNextUint(timeout, random);
30
36
  int nextFloat = RunNextFloat(timeout, random);
31
37
  int nextDouble = RunNextDouble(timeout, random);
38
+ int nextUintRange = RunNextUintRange(timeout, random);
32
39
 
33
40
  UnityEngine.Debug.Log(
34
- $"| {random.GetType().Name} | {(nextInt / timeout.TotalSeconds):N0} | {(nextFloat / timeout.TotalSeconds):N0} | {(nextDouble / timeout.TotalSeconds):N0} |"
41
+ $"| {random.GetType().Name} | "
42
+ + $"{(nextBool / timeout.TotalSeconds):N0} | "
43
+ + $"{(nextInt / timeout.TotalSeconds):N0} | "
44
+ + $"{(nextUint / timeout.TotalSeconds):N0} | "
45
+ + $"{(nextFloat / timeout.TotalSeconds):N0} | "
46
+ + $"{(nextDouble / timeout.TotalSeconds):N0} |"
47
+ + $"{(nextUintRange / timeout.TotalSeconds):N0} |"
35
48
  );
36
49
  }
37
50
 
@@ -50,6 +63,48 @@
50
63
  return count;
51
64
  }
52
65
 
66
+ private static int RunNextBool<T>(TimeSpan timeout, T random)
67
+ where T : IRandom
68
+ {
69
+ int count = 0;
70
+ Stopwatch timer = Stopwatch.StartNew();
71
+ do
72
+ {
73
+ _ = random.NextBool();
74
+ ++count;
75
+ } while (timer.Elapsed < timeout);
76
+
77
+ return count;
78
+ }
79
+
80
+ private static int RunNextUint<T>(TimeSpan timeout, T random)
81
+ where T : IRandom
82
+ {
83
+ int count = 0;
84
+ Stopwatch timer = Stopwatch.StartNew();
85
+ do
86
+ {
87
+ _ = random.NextUint();
88
+ ++count;
89
+ } while (timer.Elapsed < timeout);
90
+
91
+ return count;
92
+ }
93
+
94
+ private static int RunNextUintRange<T>(TimeSpan timeout, T random)
95
+ where T : IRandom
96
+ {
97
+ int count = 0;
98
+ Stopwatch timer = Stopwatch.StartNew();
99
+ do
100
+ {
101
+ _ = random.NextUint(1_000);
102
+ ++count;
103
+ } while (timer.Elapsed < timeout);
104
+
105
+ return count;
106
+ }
107
+
53
108
  private static int RunNextFloat<T>(TimeSpan timeout, T random)
54
109
  where T : IRandom
55
110
  {
@@ -1,17 +1,18 @@
1
1
  namespace UnityHelpers.Tests.Performance
2
2
  {
3
- using NUnit.Framework;
4
- using System.Collections.Generic;
5
- using System.Diagnostics;
6
3
  using System;
7
4
  using System.Collections;
5
+ using System.Collections.Generic;
6
+ using System.Diagnostics;
8
7
  using System.Linq;
9
8
  using System.Threading.Tasks;
10
- using UnityEngine;
11
9
  using Core.DataStructure;
10
+ using NUnit.Framework;
11
+ using UnityEngine;
12
12
  using UnityEngine.TestTools;
13
13
 
14
- public abstract class SpatialTreePerformanceTest<TTree> where TTree : ISpatialTree<Vector2>
14
+ public abstract class SpatialTreePerformanceTest<TTree>
15
+ where TTree : ISpatialTree<Vector2>
15
16
  {
16
17
  protected abstract TTree CreateTree(IEnumerable<Vector2> points);
17
18
 
@@ -23,11 +24,15 @@
23
24
 
24
25
  Vector2[] points = new Vector2[1_000_000];
25
26
  float radius = 500;
26
- ParallelLoopResult result = Parallel.For(0, 1_000_000, index =>
27
- {
28
- // ReSharper disable once PossibleLossOfFraction
29
- points[index] = new Vector2(index % 1_000, index / 1_000);
30
- });
27
+ ParallelLoopResult result = Parallel.For(
28
+ 0,
29
+ 1_000_000,
30
+ index =>
31
+ {
32
+ // ReSharper disable once PossibleLossOfFraction
33
+ points[index] = new Vector2(index % 1_000, index / 1_000);
34
+ }
35
+ );
31
36
 
32
37
  while (!result.IsCompleted)
33
38
  {
@@ -37,7 +42,9 @@
37
42
  Stopwatch timer = Stopwatch.StartNew();
38
43
  TTree tree = CreateTree(points);
39
44
  timer.Stop();
40
- UnityEngine.Debug.Log($"| Construction (1 million points) | {(int)Math.Floor(1 / timer.Elapsed.TotalSeconds)} ({timer.Elapsed.TotalSeconds} total) |");
45
+ UnityEngine.Debug.Log(
46
+ $"| Construction (1 million points) | {(int)Math.Floor(1 / timer.Elapsed.TotalSeconds)} ({timer.Elapsed.TotalSeconds} seconds total) |"
47
+ );
41
48
  Vector2 center = tree.Boundary.center;
42
49
  int count = 0;
43
50
  TimeSpan timeout = TimeSpan.FromSeconds(1);
@@ -47,10 +54,11 @@
47
54
  int elementsInRange = tree.GetElementsInRange(center, radius).Count();
48
55
  Assert.AreEqual(785456, elementsInRange);
49
56
  ++count;
50
- }
51
- while (timer.Elapsed < timeout);
57
+ } while (timer.Elapsed < timeout);
52
58
 
53
- UnityEngine.Debug.Log($"| Elements In Range - Full | {(int)Math.Floor(count / timeout.TotalSeconds)} |");
59
+ UnityEngine.Debug.Log(
60
+ $"| Elements In Range - Full | {(int)Math.Floor(count / timeout.TotalSeconds)} |"
61
+ );
54
62
 
55
63
  radius /= 2f;
56
64
  count = 0;
@@ -60,9 +68,10 @@
60
68
  int elementsInRange = tree.GetElementsInRange(center, radius).Count();
61
69
  Assert.AreEqual(196364, elementsInRange);
62
70
  ++count;
63
- }
64
- while (timer.Elapsed < timeout);
65
- UnityEngine.Debug.Log($"| Elements In Range - Half | {(int)Math.Floor(count / timeout.TotalSeconds)} |");
71
+ } while (timer.Elapsed < timeout);
72
+ UnityEngine.Debug.Log(
73
+ $"| Elements In Range - Half | {(int)Math.Floor(count / timeout.TotalSeconds)} |"
74
+ );
66
75
 
67
76
  radius /= 2f;
68
77
  count = 0;
@@ -72,9 +81,10 @@
72
81
  int elementsInRange = tree.GetElementsInRange(center, radius).Count();
73
82
  Assert.AreEqual(49080, elementsInRange);
74
83
  ++count;
75
- }
76
- while (timer.Elapsed < timeout);
77
- UnityEngine.Debug.Log($"| Elements In Range - Quarter | {(int)Math.Floor(count / timeout.TotalSeconds)} |");
84
+ } while (timer.Elapsed < timeout);
85
+ UnityEngine.Debug.Log(
86
+ $"| Elements In Range - Quarter | {(int)Math.Floor(count / timeout.TotalSeconds)} |"
87
+ );
78
88
 
79
89
  radius = 1f;
80
90
  count = 0;
@@ -84,9 +94,10 @@
84
94
  int elementsInRange = tree.GetElementsInRange(center, radius).Count();
85
95
  Assert.AreEqual(4, elementsInRange);
86
96
  ++count;
87
- }
88
- while (timer.Elapsed < timeout);
89
- UnityEngine.Debug.Log($"| Elements In Range - 1 Range | {(int)Math.Floor(count / timeout.TotalSeconds)} |");
97
+ } while (timer.Elapsed < timeout);
98
+ UnityEngine.Debug.Log(
99
+ $"| Elements In Range - 1 Range | {(int)Math.Floor(count / timeout.TotalSeconds)} |"
100
+ );
90
101
 
91
102
  int nearestNeighborCount = 500;
92
103
  List<Vector2> nearestNeighbors = new();
@@ -97,9 +108,10 @@
97
108
  tree.GetApproximateNearestNeighbors(center, nearestNeighborCount, nearestNeighbors);
98
109
  Assert.IsTrue(nearestNeighbors.Count <= nearestNeighborCount);
99
110
  ++count;
100
- }
101
- while (timer.Elapsed < timeout);
102
- UnityEngine.Debug.Log($"| ANN - 500 | {(int)Math.Floor(count / timeout.TotalSeconds)} |");
111
+ } while (timer.Elapsed < timeout);
112
+ UnityEngine.Debug.Log(
113
+ $"| ANN - 500 | {(int)Math.Floor(count / timeout.TotalSeconds)} |"
114
+ );
103
115
 
104
116
  nearestNeighborCount = 100;
105
117
  count = 0;
@@ -109,9 +121,10 @@
109
121
  tree.GetApproximateNearestNeighbors(center, nearestNeighborCount, nearestNeighbors);
110
122
  Assert.IsTrue(nearestNeighbors.Count <= nearestNeighborCount);
111
123
  ++count;
112
- }
113
- while (timer.Elapsed < timeout);
114
- UnityEngine.Debug.Log($"| ANN - 100 | {(int)Math.Floor(count / timeout.TotalSeconds)} |");
124
+ } while (timer.Elapsed < timeout);
125
+ UnityEngine.Debug.Log(
126
+ $"| ANN - 100 | {(int)Math.Floor(count / timeout.TotalSeconds)} |"
127
+ );
115
128
 
116
129
  nearestNeighborCount = 10;
117
130
  count = 0;
@@ -121,9 +134,10 @@
121
134
  tree.GetApproximateNearestNeighbors(center, nearestNeighborCount, nearestNeighbors);
122
135
  Assert.IsTrue(nearestNeighbors.Count <= nearestNeighborCount);
123
136
  ++count;
124
- }
125
- while (timer.Elapsed < timeout);
126
- UnityEngine.Debug.Log($"| ANN - 10 | {(int)Math.Floor(count / timeout.TotalSeconds)} |");
137
+ } while (timer.Elapsed < timeout);
138
+ UnityEngine.Debug.Log(
139
+ $"| ANN - 10 | {(int)Math.Floor(count / timeout.TotalSeconds)} |"
140
+ );
127
141
 
128
142
  nearestNeighborCount = 1;
129
143
  count = 0;
@@ -133,8 +147,7 @@
133
147
  tree.GetApproximateNearestNeighbors(center, nearestNeighborCount, nearestNeighbors);
134
148
  Assert.IsTrue(nearestNeighbors.Count <= nearestNeighborCount);
135
149
  ++count;
136
- }
137
- while (timer.Elapsed < timeout);
150
+ } while (timer.Elapsed < timeout);
138
151
  UnityEngine.Debug.Log($"| ANN - 1 | {(int)Math.Floor(count / timeout.TotalSeconds)} |");
139
152
  }
140
153
  }