Skip to content
This repository was archived by the owner on Mar 2, 2024. It is now read-only.

Commit 56fb723

Browse files
committed
Fix cycler
1 parent 2f8fc86 commit 56fb723

3 files changed

Lines changed: 34 additions & 6 deletions

File tree

0 Bytes
Binary file not shown.

Control Block/Class1.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ internal class OptionMenuSwivel : MonoBehaviour
10931093
private ModuleSwivel module;
10941094

10951095
private Rect win;
1096-
private readonly string[] modeOptions = new string[] { "Positional", "Directional", "Speed", "On/Off", "Target Aim", "Steering", "Player Aim", "Velocity Aim", "Speed (Bounce)", "Throttle" };
1096+
private readonly string[] modeOptions = new string[] { "Positional", "Directional", "Speed", "On/Off", "Target Aim", "Steering", "Player Aim", "Velocity Aim", "Cycle", "Throttle" };
10971097

10981098
private void Update()
10991099
{

Control Block/SwivelBlock.cs

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public enum Mode : byte
2525
Turning,
2626
AimAtPlayer,
2727
AimAtVelocity,
28-
SpeedBounce,
28+
Cycle,
2929
Throttle,
3030
}
3131

@@ -150,7 +150,6 @@ private void FixedUpdate()
150150

151151
case Mode.Throttle:
152152
case Mode.Speed:
153-
case Mode.SpeedBounce:
154153
if (VInput)
155154
{
156155
if (Input.GetKey(trigger1))
@@ -186,6 +185,35 @@ private void FixedUpdate()
186185
CurrentAngle += Direction * RotateSpeed;
187186
break;
188187

188+
case Mode.Cycle:
189+
if (VInput && ButtonNotPressed)
190+
{
191+
if (Input.GetKey(trigger1))
192+
{
193+
if (Direction == 0)
194+
Direction = 1;
195+
else if (Direction == 2)
196+
Direction = 1;
197+
else if (Direction == -2)
198+
Direction = -1;
199+
else Direction += Direction;
200+
201+
}
202+
else if (Input.GetKey(trigger2))
203+
{
204+
if (Direction == 0)
205+
Direction = -1;
206+
else if (Direction == 2)
207+
Direction = -1;
208+
else if (Direction == -2)
209+
Direction = 1;
210+
else Direction = -(Direction + Direction);
211+
}
212+
}
213+
if (Direction * Direction == 1)
214+
CurrentAngle += Direction * RotateSpeed;
215+
break;
216+
189217
case Mode.Turning:
190218
if (VInput)
191219
{
@@ -217,13 +245,13 @@ private void FixedUpdate()
217245
if (Diff < -AngleRange)
218246
{
219247
CurrentAngle += (AngleCenter - AngleRange) - CurrentAngle;
220-
if (mode == Mode.SpeedBounce) Direction = -Direction;
248+
if (mode == Mode.Cycle) Direction = -Direction;
221249
else Direction = 0;
222250
}
223251
else if (Diff > AngleRange)
224252
{
225253
CurrentAngle += (AngleCenter + AngleRange) - CurrentAngle;
226-
if (mode == Mode.SpeedBounce) Direction = -Direction;
254+
if (mode == Mode.Cycle) Direction = -Direction;
227255
else Direction = 0;
228256
}
229257
}
@@ -264,7 +292,7 @@ private void FixedUpdate()
264292
Moved = false;
265293
tankcache.RequestPhysicsReset();
266294
}
267-
if (mode == Mode.OnOff)
295+
if (mode == Mode.OnOff || mode == Mode.Cycle)
268296
ButtonNotPressed = !Input.GetKey(trigger1) && !Input.GetKey(trigger2);
269297
}
270298

0 commit comments

Comments
 (0)