mirror of
https://github.com/Ratstail91/Keep-It-Alive.git
synced 2025-11-29 10:34:27 +11:00
Working on it
This commit is contained in:
32
Assets/CarbonInput/Scripts/SwitchPS4Gamepad.cs
Normal file
32
Assets/CarbonInput/Scripts/SwitchPS4Gamepad.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace CarbonInput {
|
||||
public class SwitchPS4Gamepad : MonoBehaviour {
|
||||
public CarbonController Wired;
|
||||
public CarbonController Bluetooth;
|
||||
public Toggle Toggle;
|
||||
|
||||
private int highPriority;
|
||||
private int lowPriority;
|
||||
|
||||
private void Start() {
|
||||
highPriority = Mathf.Min(Wired.Priority, Bluetooth.Priority);
|
||||
lowPriority = Mathf.Max(Wired.Priority, Bluetooth.Priority);
|
||||
if(Toggle != null) {
|
||||
Toggle.isOn = Bluetooth.Priority < Wired.Priority;
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeMapping(bool useBluetooth) {
|
||||
if(useBluetooth) {
|
||||
Bluetooth.Priority = highPriority;
|
||||
Wired.Priority = lowPriority;
|
||||
} else {
|
||||
Wired.Priority = highPriority;
|
||||
Bluetooth.Priority = lowPriority;
|
||||
}
|
||||
GamePad.ReInit();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user