com.wallstop-studios.unity-helpers 2.0.0-rc78.4 → 2.0.0-rc78.6

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.
@@ -0,0 +1,82 @@
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
+ public Vector3 localOffset;
25
+
26
+ public MatchTransformMode mode = MatchTransformMode.Update;
27
+
28
+ [SiblingComponent]
29
+ private Transform _transform;
30
+
31
+ private void Awake()
32
+ {
33
+ this.AssignRelationalComponents();
34
+ if (mode.HasFlagNoAlloc(MatchTransformMode.Awake))
35
+ {
36
+ Match();
37
+ }
38
+ }
39
+
40
+ private void Start()
41
+ {
42
+ if (mode.HasFlagNoAlloc(MatchTransformMode.Start))
43
+ {
44
+ Match();
45
+ }
46
+ }
47
+
48
+ private void Update()
49
+ {
50
+ if (mode.HasFlagNoAlloc(MatchTransformMode.Update))
51
+ {
52
+ Match();
53
+ }
54
+ }
55
+
56
+ private void FixedUpdate()
57
+ {
58
+ if (mode.HasFlagNoAlloc(MatchTransformMode.FixedUpdate))
59
+ {
60
+ Match();
61
+ }
62
+ }
63
+
64
+ private void LateUpdate()
65
+ {
66
+ if (mode.HasFlagNoAlloc(MatchTransformMode.LateUpdate))
67
+ {
68
+ Match();
69
+ }
70
+ }
71
+
72
+ private void Match()
73
+ {
74
+ if (toMatch == null)
75
+ {
76
+ return;
77
+ }
78
+
79
+ _transform.position = toMatch.position + localOffset;
80
+ }
81
+ }
82
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 1287651a73274b489dcb1b258c556059
3
+ timeCreated: 1753459338
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.wallstop-studios.unity-helpers",
3
- "version": "2.0.0-rc78.4",
3
+ "version": "2.0.0-rc78.6",
4
4
  "displayName": "Unity Helpers",
5
5
  "description": "Various Unity Helper Library",
6
6
  "dependencies": {},
@@ -38,3 +38,5 @@
38
38
  }
39
39
 
40
40
 
41
+
42
+