Removed controller support
This commit is contained in:
parent
1c0b2dcf68
commit
4f0615e2d9
@ -662,7 +662,7 @@
|
||||
{
|
||||
"name": "",
|
||||
"id": "3876ad34-0e23-4436-bd5f-84c8411dee1a",
|
||||
"path": "<Keyboard>/i",
|
||||
"path": "<Keyboard>/c",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "KeyboardMouse",
|
||||
@ -865,17 +865,6 @@
|
||||
"isOR": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Controller",
|
||||
"bindingGroup": "Controller",
|
||||
"devices": [
|
||||
{
|
||||
"devicePath": "<Gamepad>",
|
||||
"isOptional": false,
|
||||
"isOR": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -17,11 +17,9 @@ public class Controls : MonoBehaviour
|
||||
UIHandler uihandler;
|
||||
Vector3 input;
|
||||
Vector2 view;
|
||||
PlayerInput playerInput;
|
||||
public PlayerInput playerInput;
|
||||
MoveDirection direction;
|
||||
|
||||
public Vector2 sensitivityController = new Vector2(0,0);
|
||||
public Vector2 sensitivityMouse = new Vector2(0,0);
|
||||
public Vector2 sensitivityMouse = new Vector2(0, 0);
|
||||
|
||||
float multiplier = 0.01f; //DEV Purpose only
|
||||
|
||||
@ -55,14 +53,8 @@ public class Controls : MonoBehaviour
|
||||
{
|
||||
if (uihandler.canPlayerRotate())
|
||||
{
|
||||
if(playerInput.currentControlScheme == "Controller"){
|
||||
playerCam.GetComponent<PlayerCamera>().LookAround(view, sensitivityController * multiplier);
|
||||
player.GetComponent<PlayerGameObject>().rotate(view, sensitivityController * multiplier);
|
||||
}
|
||||
else{
|
||||
playerCam.GetComponent<PlayerCamera>().LookAround(view, sensitivityMouse * multiplier);
|
||||
player.GetComponent<PlayerGameObject>().rotate(view, sensitivityMouse * multiplier);
|
||||
}
|
||||
playerCam.GetComponent<PlayerCamera>().LookAround(view, sensitivityMouse * multiplier);
|
||||
player.GetComponent<PlayerGameObject>().rotate(view, sensitivityMouse * multiplier);
|
||||
}
|
||||
if (uihandler.canPlayerMove())
|
||||
{
|
||||
@ -74,7 +66,6 @@ public class Controls : MonoBehaviour
|
||||
|
||||
public void FixedUpdate()
|
||||
{
|
||||
Debug.Log(playerInput.currentControlScheme);
|
||||
if (direction != MoveDirection.None)
|
||||
{
|
||||
AxisEventData data = new AxisEventData(EventSystem.current);
|
||||
@ -82,30 +73,18 @@ public class Controls : MonoBehaviour
|
||||
data.selectedObject = EventSystem.current.currentSelectedGameObject;
|
||||
ExecuteEvents.Execute(data.selectedObject, data, ExecuteEvents.moveHandler);
|
||||
}
|
||||
if (playerInput.currentControlScheme == "Controller")
|
||||
if (uihandler.canPlayerRotate())
|
||||
{
|
||||
if (Cursor.lockState != CursorLockMode.Locked)
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
}
|
||||
GameObject.Find("txtInteract").GetComponent<Text>().text = GameObject.Find("txtInteract").GetComponent<Text>().text.Replace("[E]", "[ButtonEast]");
|
||||
GameObject.Find("txtInteraction_Tutorial").GetComponent<Text>().text = GameObject.Find("txtInteraction_Tutorial").GetComponent<Text>().text.Replace("[E]", "[ButtonEast]");
|
||||
GameObject.Find("txtTutorialGoal").GetComponent<Text>().text = GameObject.Find("txtTutorialGoal").GetComponent<Text>().text.Replace("[ESC]", "[Start]");
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (uihandler.canPlayerRotate())
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
}
|
||||
else
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.Confined;
|
||||
}
|
||||
GameObject.Find("txtInteract").GetComponent<Text>().text = GameObject.Find("txtInteract").GetComponent<Text>().text.Replace("[ButtonEast]", "[E]");
|
||||
GameObject.Find("txtInteraction_Tutorial").GetComponent<Text>().text = GameObject.Find("txtInteraction_Tutorial").GetComponent<Text>().text.Replace("[E]", "[ButtonEast]");
|
||||
GameObject.Find("txtTutorialGoal").GetComponent<Text>().text = GameObject.Find("txtTutorialGoal").GetComponent<Text>().text.Replace("[Start]", "[ESC]");
|
||||
Cursor.lockState = CursorLockMode.Confined;
|
||||
}
|
||||
GameObject.Find("txtInteract").GetComponent<Text>().text = GameObject.Find("txtInteract").GetComponent<Text>().text.Replace("[ButtonEast]", "[E]");
|
||||
GameObject.Find("txtInteraction_Tutorial").GetComponent<Text>().text = GameObject.Find("txtInteraction_Tutorial").GetComponent<Text>().text.Replace("[E]", "[ButtonEast]");
|
||||
GameObject.Find("txtTutorialGoal").GetComponent<Text>().text = GameObject.Find("txtTutorialGoal").GetComponent<Text>().text.Replace("[Start]", "[ESC]");
|
||||
|
||||
}
|
||||
|
||||
public void OnLooking(InputValue value)
|
||||
|
||||
@ -89,11 +89,6 @@ namespace Assets.Scripts
|
||||
GameObject.Find("slideSensitivityMouseHorizontal").GetComponent<Slider>().value,
|
||||
GameObject.Find("slideSensitivityMouseVertical").GetComponent<Slider>().value
|
||||
);
|
||||
GameObject.Find("Controls").GetComponent<Controls>().sensitivityController = new Vector2(
|
||||
GameObject.Find("slideSensitivityControllerHorizontal").GetComponent<Slider>().value,
|
||||
GameObject.Find("slideSensitivityControllerVertical").GetComponent<Slider>().value
|
||||
);
|
||||
saveText = saveText + "SensitivityController:"+GameObject.Find("slideSensitivityControllerHorizontal").GetComponent<Slider>().value + "/" + GameObject.Find("slideSensitivityControllerVertical").GetComponent<Slider>().value + "\r\n";
|
||||
saveText = saveText + "SensitivityMouse:"+GameObject.Find("slideSensitivityMouseHorizontal").GetComponent<Slider>().value + "/" + GameObject.Find("slideSensitivityMouseVertical").GetComponent<Slider>().value;
|
||||
FileHandler.saveOptions(saveText);
|
||||
uihandler.closeOptions();
|
||||
|
||||
@ -60,7 +60,6 @@ namespace Assets.Scripts
|
||||
sw.WriteLine("Mode:0");
|
||||
sw.WriteLine("Language:en");
|
||||
sw.WriteLine("SensitivityMouse:1/1");
|
||||
sw.WriteLine("SensitivityController:1/1");
|
||||
sw.Flush();
|
||||
sw.Close();
|
||||
}
|
||||
@ -110,14 +109,6 @@ namespace Assets.Scripts
|
||||
);
|
||||
}
|
||||
break;
|
||||
case "SensitivityController":
|
||||
if(isIngame){
|
||||
GameObject.Find("Controls").GetComponent<Controls>().sensitivityController = new Vector2(
|
||||
float.Parse(line.Split(':')[1].Split("/")[0]),
|
||||
float.Parse(line.Split(':')[1].Split("/")[1])
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -145,10 +136,6 @@ namespace Assets.Scripts
|
||||
GameObject.Find("slideSensitivityMouseHorizontal").GetComponent<Slider>().value = float.Parse(line.Split(':')[1].Split("/")[0]);
|
||||
GameObject.Find("slideSensitivityMouseVertical").GetComponent<Slider>().value = float.Parse(line.Split(':')[1].Split("/")[1]);
|
||||
break;
|
||||
case "SensitivityController":
|
||||
GameObject.Find("slideSensitivityControllerHorizontal").GetComponent<Slider>().value = float.Parse(line.Split(':')[1].Split("/")[0]);
|
||||
GameObject.Find("slideSensitivityControllerVertical").GetComponent<Slider>().value = float.Parse(line.Split(':')[1].Split("/")[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +71,6 @@ namespace Assets.Scripts.Menu
|
||||
saveText = saveText + uihandler.saveVideoSettings() + "\r\n";
|
||||
saveText = saveText + uihandler.saveLanguage() + "\r\n";
|
||||
saveText = saveText + audioHandler.saveAudioSettings() + "\r\n";
|
||||
saveText = saveText + "SensitivityController:"+GameObject.Find("slideSensitivityControllerHorizontal").GetComponent<Slider>().value + "/" + GameObject.Find("slideSensitivityControllerVertical").GetComponent<Slider>().value + "\r\n";
|
||||
saveText = saveText + "SensitivityMouse:"+GameObject.Find("slideSensitivityMouseHorizontal").GetComponent<Slider>().value + "/" + GameObject.Find("slideSensitivityMouseVertical").GetComponent<Slider>().value;
|
||||
FileHandler.saveOptions(saveText);
|
||||
uihandler.closeOptions();
|
||||
|
||||
@ -25,26 +25,16 @@ public class ControlsMenu : MonoBehaviour
|
||||
void Update()
|
||||
{
|
||||
changeNameInput();
|
||||
if(playerInput.currentControlScheme == "Controller"){
|
||||
if(EventSystem.current.currentSelectedGameObject == null){
|
||||
EventSystem.current.SetSelectedGameObject(FindFirstObjectByType<Button>().gameObject);
|
||||
}
|
||||
if(Cursor.lockState != CursorLockMode.Locked){
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
}
|
||||
if(playerInput.currentActionMap.name != "Menu"){
|
||||
playerInput.SwitchCurrentActionMap("Menu");
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(Cursor.lockState != CursorLockMode.Confined){
|
||||
Cursor.lockState = CursorLockMode.Confined;
|
||||
}
|
||||
if (Cursor.lockState != CursorLockMode.Confined)
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.Confined;
|
||||
}
|
||||
}
|
||||
|
||||
public void FixedUpdate(){
|
||||
if(direction != MoveDirection.None){
|
||||
public void FixedUpdate()
|
||||
{
|
||||
if (direction != MoveDirection.None)
|
||||
{
|
||||
AxisEventData data = new AxisEventData(EventSystem.current);
|
||||
data.moveDir = direction;
|
||||
data.selectedObject = EventSystem.current.currentSelectedGameObject;
|
||||
@ -52,36 +42,33 @@ public class ControlsMenu : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void OnMovement(InputValue value){
|
||||
if(value.Get<Vector2>().x < 0){
|
||||
public void OnMovement(InputValue value)
|
||||
{
|
||||
if (value.Get<Vector2>().x < 0)
|
||||
{
|
||||
direction = MoveDirection.Left;
|
||||
}
|
||||
else if(value.Get<Vector2>().x > 0){
|
||||
else if (value.Get<Vector2>().x > 0)
|
||||
{
|
||||
direction = MoveDirection.Right;
|
||||
}
|
||||
else if(value.Get<Vector2>().y < 0){
|
||||
else if (value.Get<Vector2>().y < 0)
|
||||
{
|
||||
direction = MoveDirection.Down;
|
||||
}
|
||||
else if(value.Get<Vector2>().y > 0){
|
||||
else if (value.Get<Vector2>().y > 0)
|
||||
{
|
||||
direction = MoveDirection.Up;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnBack(){
|
||||
public void OnBack()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void changeNameInput(){
|
||||
if(uihandler.isCharacterCreation()){
|
||||
if(playerInput.currentControlScheme == "Controller"){
|
||||
if(EventSystem.current.currentSelectedGameObject == null || EventSystem.current.currentSelectedGameObject == GameObject.Find("inName")){
|
||||
EventSystem.current.SetSelectedGameObject(GameObject.Find("btnRandomName"));
|
||||
}
|
||||
GameObject.Find("inName").GetComponent<InputField>().interactable = false;
|
||||
}
|
||||
else{
|
||||
GameObject.Find("inName").GetComponent<InputField>().interactable = true;
|
||||
}
|
||||
}
|
||||
public void changeNameInput()
|
||||
{
|
||||
GameObject.Find("inName").GetComponent<InputField>().interactable = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,10 +18,10 @@ EditorUserSettings:
|
||||
value: 065551555651080c54570d2741715e1541154a79752925322f2c4965b7b0646d
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-4:
|
||||
value: 56060d5e5301505e0f5a5a2344200944154e4128792a2763297b4a30b2e2363a
|
||||
value: 5a5757560101590a5d0c0e24427b5d44434e4c7a7b7a23677f2b4565b7b5353a
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-5:
|
||||
value: 5a5757560101590a5d0c0e24427b5d44434e4c7a7b7a23677f2b4565b7b5353a
|
||||
value: 56060d5e5301505e0f5a5a2344200944154e4128792a2763297b4a30b2e2363a
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-0:
|
||||
value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d
|
||||
|
||||
@ -3,5 +3,5 @@ Mode:0
|
||||
Language:en
|
||||
Music:0
|
||||
Effects:0
|
||||
SensitivityController:1/1
|
||||
SensitivityController:50.49999/1
|
||||
SensitivityMouse:42.32454/58.06303
|
||||
Loading…
x
Reference in New Issue
Block a user