refactor: moved a lot of player related scripts to the Reset.Units namespace
This commit is contained in:
@@ -4,32 +4,33 @@ 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;
|
||||
}
|
||||
namespace Reset.Units{
|
||||
public class InputFinder : MonoBehaviour{
|
||||
public InputActionMap actionMap;
|
||||
|
||||
public void AwaitNewInput(){
|
||||
GameManager.ClearCurrentController();
|
||||
|
||||
GetComponent<UIDocument>().enabled = true;
|
||||
actionMap.Enable();
|
||||
}
|
||||
void Start(){
|
||||
actionMap.actions[0].performed += ctx => { InputPressed(ctx); };
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
GetComponent<UIDocument>().enabled = false;
|
||||
actionMap.Disable();
|
||||
public void AwaitNewInput(){
|
||||
PlayerManager.ClearCurrentController();
|
||||
|
||||
GetComponent<UIDocument>().enabled = true;
|
||||
actionMap.Enable();
|
||||
}
|
||||
|
||||
void InputPressed(InputAction.CallbackContext context){
|
||||
try {
|
||||
PlayerManager.AttachControllerToPlayer(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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user