public override void OnRun() { if (UnityEngine.Input.touchCount == 1 && UnityEngine.Input.GetTouch(0).phase == TouchPhase.Began) { Facade.SetButtonDown(InputButtonType.MouseLeft); } else if (UnityEngine.Input.touchCount == 1 && UnityEngine.Input.GetTouch(0).phase == TouchPhase.Ended) { Facade.SetButtonUp(InputButtonType.MouseLeft); } if (UnityEngine.Input.touchCount == 2 && UnityEngine.Input.GetTouch(0).phase == TouchPhase.Began && UnityEngine.Input.GetTouch(1).phase == TouchPhase.Began) { Facade.SetButtonDown(InputButtonType.MouseRight); } else { Facade.SetButtonUp(InputButtonType.MouseRight); } Facade.SetButtonUp(InputButtonType.MouseMiddle); Facade.SetAxis(InputAxisType.MouseX, UnityEngine.Input.GetAxis("Horizontal")); Facade.SetAxis(InputAxisType.MouseY, UnityEngine.Input.GetAxis("Vertical")); Facade.SetAxis(InputAxisType.MouseScrollWheel, 0); Facade.SetAxis(InputAxisType.Horizontal, UnityEngine.Input.GetAxis("Horizontal")); Facade.SetAxis(InputAxisType.Vertical, UnityEngine.Input.GetAxis("Vertical")); if (UnityEngine.Input.touchCount == 1) { Facade.SetVirtualMousePosition(UnityEngine.Input.GetTouch(0).position); } else { Facade.SetVirtualMousePosition(Vector3.zero); } }
public override void OnRun() { if (UnityEngine.Input.GetKeyDown(KeyCode.LeftShift)) { Facade.SetButtonDown(InputButtonType.LeftShift); } else if (UnityEngine.Input.GetKeyUp(KeyCode.LeftShift)) { Facade.SetButtonUp(InputButtonType.LeftShift); } if (UnityEngine.Input.GetKeyDown(KeyCode.Escape)) { Facade.SetButtonDown(InputButtonType.Escape); } else if (UnityEngine.Input.GetKeyUp(KeyCode.Escape)) { Facade.SetButtonUp(InputButtonType.Escape); } if (UnityEngine.Input.GetMouseButtonDown(0)) { Facade.SetButtonDown(InputButtonType.MouseLeft); } else if (UnityEngine.Input.GetMouseButtonUp(0)) { Facade.SetButtonUp(InputButtonType.MouseLeft); } if (UnityEngine.Input.GetMouseButtonDown(1)) { Facade.SetButtonDown(InputButtonType.MouseRight); } else if (UnityEngine.Input.GetMouseButtonUp(1)) { Facade.SetButtonUp(InputButtonType.MouseRight); } if (UnityEngine.Input.GetMouseButtonDown(2)) { Facade.SetButtonDown(InputButtonType.MouseMiddle); } else if (UnityEngine.Input.GetMouseButtonUp(2)) { Facade.SetButtonUp(InputButtonType.MouseMiddle); } if (UnityEngine.Input.GetMouseButtonDown(0)) { if (mouseLeftClickTimer <= 0) { mouseLeftClickTimer = mouseLeftDoubleClickInterval; } else { mouseLeftClickTimer = 0; Facade.SetButtonDown(InputButtonType.MouseLeftDoubleClick); Facade.SetButtonUp(InputButtonType.MouseLeftDoubleClick); } } if (mouseLeftClickTimer > 0) { mouseLeftClickTimer -= Time.deltaTime; } Facade.SetAxis(InputAxisType.MouseX, UnityEngine.Input.GetAxis("Mouse X")); Facade.SetAxis(InputAxisType.MouseY, UnityEngine.Input.GetAxis("Mouse Y")); Facade.SetAxis(InputAxisType.MouseScrollWheel, UnityEngine.Input.GetAxis("Mouse ScrollWheel")); Facade.SetAxis(InputAxisType.Horizontal, UnityEngine.Input.GetAxis("Horizontal")); Facade.SetAxis(InputAxisType.Vertical, UnityEngine.Input.GetAxis("Vertical")); if (UnityEngine.Input.GetKey(KeyCode.UpArrow)) { upperLowerValue -= Time.deltaTime; } else if (UnityEngine.Input.GetKey(KeyCode.DownArrow)) { upperLowerValue += Time.deltaTime; } else { upperLowerValue = 0; } Facade.SetVirtualMousePosition(UnityEngine.Input.mousePosition); }