|
1 |
| -// Visual Pinball Engine |
2 |
| -// Copyright (C) 2022 freezy and VPE Team |
3 |
| -// |
4 |
| -// This program is free software: you can redistribute it and/or modify |
5 |
| -// it under the terms of the GNU General Public License as published by |
6 |
| -// the Free Software Foundation, either version 3 of the License, or |
7 |
| -// (at your option) any later version. |
8 |
| -// |
9 |
| -// This program is distributed in the hope that it will be useful, |
10 |
| -// but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 |
| -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 |
| -// GNU General Public License for more details. |
13 |
| -// |
14 |
| -// You should have received a copy of the GNU General Public License |
15 |
| -// along with this program. If not, see <https://www.gnu.org/licenses/>. |
16 |
| - |
17 |
| -using System.Collections.Generic; |
18 |
| -using System.Collections.ObjectModel; |
| 1 | +// Visual Pinball Engine |
| 2 | +// Copyright (C) 2022 freezy and VPE Team |
| 3 | +// |
| 4 | +// This program is free software: you can redistribute it and/or modify |
| 5 | +// it under the terms of the GNU General Public License as published by |
| 6 | +// the Free Software Foundation, either version 3 of the License, or |
| 7 | +// (at your option) any later version. |
| 8 | +// |
| 9 | +// This program is distributed in the hope that it will be useful, |
| 10 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | +// GNU General Public License for more details. |
| 13 | +// |
| 14 | +// You should have received a copy of the GNU General Public License |
| 15 | +// along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 16 | + |
| 17 | +using System.Collections.Generic; |
| 18 | +using System.Collections.ObjectModel; |
19 | 19 | using Unity.VisualScripting;
|
20 |
| -using UnityEngine; |
21 |
| - |
| 20 | +using UnityEngine; |
| 21 | + |
22 | 22 | namespace VisualPinball.Unity.VisualScripting
|
23 | 23 | {
|
24 | 24 | [UnitTitle("On Lamp Changed")]
|
25 | 25 | [UnitSurtitle("Gamelogic Engine")]
|
26 |
| - [UnitCategory("Events\\Visual Pinball")] |
| 26 | + [UnitCategory("Events\\Pinball")] |
27 | 27 | public sealed class LampEventUnit : GleEventUnit<LampEventArgs>, IMultiInputUnit
|
28 | 28 | {
|
29 | 29 | [SerializeAs(nameof(inputCount))]
|
@@ -59,26 +59,26 @@ protected override void Definition()
|
59 | 59 | {
|
60 | 60 | base.Definition();
|
61 | 61 |
|
62 |
| - var _multiInputs = new List<ValueInput>(); |
63 |
| - |
64 |
| - multiInputs = _multiInputs.AsReadOnly(); |
65 |
| - |
66 |
| - for (var i = 0; i < inputCount; i++) { |
67 |
| - _multiInputs.Add(ValueInput(i.ToString(), string.Empty)); |
| 62 | + var _multiInputs = new List<ValueInput>(); |
| 63 | + |
| 64 | + multiInputs = _multiInputs.AsReadOnly(); |
| 65 | + |
| 66 | + for (var i = 0; i < inputCount; i++) { |
| 67 | + _multiInputs.Add(ValueInput(i.ToString(), string.Empty)); |
68 | 68 | }
|
69 | 69 |
|
70 | 70 | Value = ValueOutput<float>(nameof(Value));
|
71 | 71 | IsEnabled = ValueOutput<bool>(nameof(IsEnabled));
|
72 |
| - } |
73 |
| - |
| 72 | + } |
| 73 | + |
74 | 74 | protected override bool ShouldTrigger(Flow flow, LampEventArgs args)
|
75 | 75 | {
|
76 |
| - foreach (var input in multiInputs) { |
77 |
| - if (flow.GetValue<string>(input) == args.Id) { |
78 |
| - return true; |
79 |
| - } |
80 |
| - } |
81 |
| - |
| 76 | + foreach (var input in multiInputs) { |
| 77 | + if (flow.GetValue<string>(input) == args.Id) { |
| 78 | + return true; |
| 79 | + } |
| 80 | + } |
| 81 | + |
82 | 82 | return false;
|
83 | 83 | }
|
84 | 84 |
|
|
0 commit comments