Reversing Player Controls
Difficulty: 1/10
private BindingSource[] ActionDownValueP1 = new BindingSource[4];
private BindingSource[] ActionUpValueP1 = new BindingSource[4];
private BindingSource[] ActionRightValueP1 = new BindingSource[4];
private BindingSource[] ActionLeftValueP1 = new BindingSource[4];
private bool HasAlreadyReversedControls = false;
public void ReverseControlsP1(float AmountOfTimeControlsReversed)
{
GungeonActions actions = BraveInput.PrimaryPlayerInstance.ActiveActions;
var ActionLeft = actions.Left.Bindings;
for(int i = 0; i < ActionLeft.Count; i++)
ActionLeftValueP1[i] = ActionLeft[i];
var ActionRight = actions.Right.Bindings;
for (int i = 0; i < ActionRight.Count; i++)
ActionRightValueP1[i] = ActionRight[i];
var ActionUp = actions.Up.Bindings;
for (int i = 0; i < ActionUp.Count; i++)
ActionUpValueP1[i] = ActionUp[i];
var ActionDown = actions.Down.Bindings;
for (int i = 0; i < ActionDown.Count; i++)
ActionDownValueP1[i] = ActionDown[i];
actions.Left.ClearBindings();
actions.Up.ClearBindings();
actions.Down.ClearBindings();
actions.Right.ClearBindings();
for (int i = 0; i < ActionRightValueP1.Length; i++)
actions.Left.AddBinding(ActionRightValueP1[i]);
for (int i = 0; i < ActionLeftValueP1.Length; i++)
actions.Right.AddBinding(ActionLeftValueP1[i]);
for (int i = 0; i < ActionUpValueP1.Length; i++)
actions.Down.AddBinding(ActionUpValueP1[i]);
for (int i = 0; i < ActionDownValueP1.Length; i++)
actions.Up.AddBinding(ActionDownValueP1[i]);
HasAlreadyReversedControls = true;
GameManager.Instance.StartCoroutine(FixControlsP1(AmountOfTimeControlsReversed));
}
private IEnumerator FixControlsP1(float SecondsToWait)
{
yield return new WaitForSeconds(SecondsToWait);
GungeonActions actions = BraveInput.PrimaryPlayerInstance.ActiveActions;
actions.Left.ClearBindings();
actions.Up.ClearBindings();
actions.Down.ClearBindings();
actions.Right.ClearBindings();
for (int i = 0; i < ActionLeftValueP1.Length; i++)
actions.Left.AddBinding(ActionLeftValueP1[i]);
for (int i = 0; i < ActionRightValueP1.Length; i++)
actions.Right.AddBinding(ActionRightValueP1[i]);
for (int i = 0; i < ActionDownValueP1.Length; i++)
actions.Down.AddBinding(ActionDownValueP1[i]);
for (int i = 0; i < ActionUpValueP1.Length; i++)
actions.Up.AddBinding(ActionUpValueP1[i]);
HasAlreadyReversedControls = false;
}Last updated
Was this helpful?