You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.5 KiB
68 lines
1.5 KiB
using System.Collections; |
|
using System.Collections.Generic; |
|
using Unity.VisualScripting; |
|
using UnityEngine; |
|
|
|
public class DeviceManager : MonoBehaviour |
|
{ |
|
|
|
// Start is called before the first frame update |
|
void Start() |
|
{ |
|
devices = new List<string>(); |
|
UDE_API.UDE_Init(); |
|
|
|
UDE_API.StartEnumDevices(); |
|
} |
|
|
|
private float time = 3; |
|
|
|
private List<string> devices; |
|
|
|
// Update is called once per frame |
|
void Update() |
|
{ |
|
if (time < 0) |
|
{ |
|
if (devices.Count < 2) |
|
{ |
|
devices = UDE_API.GetDeviceList(); |
|
return; |
|
} |
|
UDE_API.StopEnumDevices(); |
|
//if (string.IsNullOrEmpty(Com_L.DeviceName)) |
|
//{ |
|
// if (devices[0].Contains("L")) |
|
// { |
|
// Com_L.DeviceName = devices[0]; |
|
// } |
|
// else |
|
// { |
|
// Com_L.DeviceName = devices[1]; |
|
// } |
|
// time = 3; |
|
// return; |
|
//} |
|
|
|
//if (string.IsNullOrEmpty(Com_R.DeviceName)) |
|
//{ |
|
// if (devices[0].Contains("R")) |
|
// { |
|
// Com_R.DeviceName = devices[0]; |
|
// } |
|
// else |
|
// { |
|
// Com_R.DeviceName = devices[1]; |
|
// } |
|
// time = 4; |
|
//} |
|
} |
|
|
|
if (time > 3) |
|
{ |
|
return; |
|
} |
|
|
|
time -= Time.deltaTime; |
|
} |
|
} |