|
5 | 5 |
|
6 | 6 | namespace UdonToolkit {
|
7 | 7 | [CustomName("Secret Actions")]
|
8 |
| - [HelpURL("https://ut.orels.sh/behaviours/misc-behaviours#secret-actions")] |
9 |
| - public class SecretActions : UdonSharpBehaviour { |
10 |
| - [SectionHeader("General")] |
11 |
| - public bool active = true; |
12 |
| - |
13 |
| - [ListView("Actions List")] |
14 |
| - public string[] playerNames; |
15 |
| - [ListView("Actions List")] |
16 |
| - public UdonSharpBehaviour[] targets; |
17 |
| - |
18 |
| - [ListView("Actions List")][Popup("behaviour", "@targets")] public string[] events; |
19 |
| - |
20 |
| - private VRCPlayerApi player; |
21 |
| - |
22 |
| - private void Start() { |
23 |
| - if (!active) return; |
24 |
| - player = Networking.LocalPlayer; |
25 |
| - if (player == null) { |
26 |
| - active = false; |
27 |
| - return; |
28 |
| - } |
29 |
| - FireEvents(); |
| 8 | + [HelpURL("https://ut.orels.sh/v/v1.x/behaviours/misc-behaviours#secret-actions")] |
| 9 | + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] |
| 10 | + public class SecretActions : UdonSharpBehaviour { |
| 11 | + [SectionHeader("General")] |
| 12 | + public bool active = true; |
| 13 | + |
| 14 | + [ListView("Actions List")] |
| 15 | + public string[] playerNames; |
| 16 | + |
| 17 | + [ListView("Actions List")] |
| 18 | + public UdonSharpBehaviour[] targets; |
| 19 | + |
| 20 | + [ListView("Actions List")] [Popup("behaviour", "@targets")] |
| 21 | + public string[] events; |
| 22 | + |
| 23 | + private VRCPlayerApi player; |
| 24 | + |
| 25 | + private void Start() { |
| 26 | + if (!active) return; |
| 27 | + player = Networking.LocalPlayer; |
| 28 | + if (player == null) { |
| 29 | + active = false; |
| 30 | + return; |
30 | 31 | }
|
31 | 32 |
|
32 |
| - private void FireEvents() { |
33 |
| - for (int i = 0; i < playerNames.Length; i++) { |
34 |
| - if (playerNames[i] != player.displayName) continue; |
35 |
| - var uB = targets[i]; |
36 |
| - if (uB != null) { |
37 |
| - uB.SendCustomEvent(events[i]); |
38 |
| - } |
| 33 | + FireEvents(); |
| 34 | + } |
| 35 | + |
| 36 | + private void FireEvents() { |
| 37 | + for (int i = 0; i < playerNames.Length; i++) { |
| 38 | + if (playerNames[i] != player.displayName) continue; |
| 39 | + var uB = targets[i]; |
| 40 | + if (uB != null) { |
| 41 | + uB.SendCustomEvent(events[i]); |
39 | 42 | }
|
40 | 43 | }
|
41 |
| - |
42 |
| - public void Trigger() { |
43 |
| - if (!active) return; |
44 |
| - FireEvents(); |
45 |
| - } |
46 | 44 | }
|
| 45 | + |
| 46 | + public void Trigger() { |
| 47 | + if (!active) return; |
| 48 | + FireEvents(); |
| 49 | + } |
| 50 | + } |
47 | 51 | }
|
0 commit comments