com.wallstop-studios.unity-helpers 2.0.0-rc78.3 → 2.0.0-rc78.5
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.
|
@@ -18,6 +18,9 @@ namespace WallstopStudios.UnityHelpers.Core.Random
|
|
|
18
18
|
{
|
|
19
19
|
private const int UintByteCount = sizeof(uint) * 8;
|
|
20
20
|
|
|
21
|
+
public static XoroShiroEnhancedRandom Instance =>
|
|
22
|
+
ThreadLocalRandom<XoroShiroEnhancedRandom>.Instance;
|
|
23
|
+
|
|
21
24
|
public override RandomState InternalState
|
|
22
25
|
{
|
|
23
26
|
get
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
namespace WallstopStudios.UnityHelpers.Utils
|
|
2
|
+
{
|
|
3
|
+
using System;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
using WallstopStudios.UnityHelpers.Core.Attributes;
|
|
6
|
+
using WallstopStudios.UnityHelpers.Core.Extension;
|
|
7
|
+
|
|
8
|
+
[Flags]
|
|
9
|
+
public enum MatchTransformMode
|
|
10
|
+
{
|
|
11
|
+
[Obsolete]
|
|
12
|
+
None = 0,
|
|
13
|
+
Update = 1 << 0,
|
|
14
|
+
FixedUpdate = 1 << 1,
|
|
15
|
+
LateUpdate = 1 << 2,
|
|
16
|
+
Awake = 1 << 3,
|
|
17
|
+
Start = 1 << 4,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
[DisallowMultipleComponent]
|
|
21
|
+
public sealed class MatchTransform : MonoBehaviour
|
|
22
|
+
{
|
|
23
|
+
public Transform toMatch;
|
|
24
|
+
|
|
25
|
+
public MatchTransformMode mode = MatchTransformMode.Update;
|
|
26
|
+
|
|
27
|
+
[SiblingComponent]
|
|
28
|
+
private Transform _transform;
|
|
29
|
+
|
|
30
|
+
private void Awake()
|
|
31
|
+
{
|
|
32
|
+
this.AssignRelationalComponents();
|
|
33
|
+
if (mode.HasFlagNoAlloc(MatchTransformMode.Awake))
|
|
34
|
+
{
|
|
35
|
+
Match();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private void Start()
|
|
40
|
+
{
|
|
41
|
+
if (mode.HasFlagNoAlloc(MatchTransformMode.Start))
|
|
42
|
+
{
|
|
43
|
+
Match();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private void Update()
|
|
48
|
+
{
|
|
49
|
+
if (mode.HasFlagNoAlloc(MatchTransformMode.Update))
|
|
50
|
+
{
|
|
51
|
+
Match();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
private void FixedUpdate()
|
|
56
|
+
{
|
|
57
|
+
if (mode.HasFlagNoAlloc(MatchTransformMode.FixedUpdate))
|
|
58
|
+
{
|
|
59
|
+
Match();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private void LateUpdate()
|
|
64
|
+
{
|
|
65
|
+
if (mode.HasFlagNoAlloc(MatchTransformMode.LateUpdate))
|
|
66
|
+
{
|
|
67
|
+
Match();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private void Match()
|
|
72
|
+
{
|
|
73
|
+
if (toMatch == null)
|
|
74
|
+
{
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
_transform.position = toMatch.position;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
package/package.json
CHANGED