change: input dialogue on player spawn

This commit is contained in:
Chris
2025-09-03 16:58:40 -04:00
parent 40badd1f95
commit 18cebf6f9c
12 changed files with 2818 additions and 83 deletions

View File

@@ -0,0 +1,35 @@
using System;
using Reset;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UIElements;
public class InputFinder : MonoBehaviour{
public InputActionMap actionMap;
void Start(){
actionMap.actions[0].performed += ctx => { InputPressed(ctx); };
GetComponent<UIDocument>().enabled = false;
}
public void AwaitNewInput(){
GameManager.ClearCurrentController();
GetComponent<UIDocument>().enabled = true;
actionMap.Enable();
}
void InputPressed(InputAction.CallbackContext context){
try {
GameManager.AttachControllerToPlayer(context.control.device);
Debug.Log(context.control.device);
} catch (Exception e) {
Debug.LogError($"Failed to set the new device to the player: {e.Message}");
return;
}
GetComponent<UIDocument>().enabled = false;
actionMap.Disable();
}
}