StandaloneInput.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System;
  2. using UnityEngine;
  3. namespace UnityStandardAssets.CrossPlatformInput.PlatformSpecific
  4. {
  5. public class StandaloneInput : VirtualInput
  6. {
  7. public override float GetAxis(string name, bool raw)
  8. {
  9. return raw ? Input.GetAxisRaw(name) : Input.GetAxis(name);
  10. }
  11. public override bool GetButton(string name)
  12. {
  13. return Input.GetButton(name);
  14. }
  15. public override bool GetButtonDown(string name)
  16. {
  17. return Input.GetButtonDown(name);
  18. }
  19. public override bool GetButtonUp(string name)
  20. {
  21. return Input.GetButtonUp(name);
  22. }
  23. public override void SetButtonDown(string name)
  24. {
  25. throw new Exception(
  26. " This is not possible to be called for standalone input. Please check your platform and code where this is called");
  27. }
  28. public override void SetButtonUp(string name)
  29. {
  30. throw new Exception(
  31. " This is not possible to be called for standalone input. Please check your platform and code where this is called");
  32. }
  33. public override void SetAxisPositive(string name)
  34. {
  35. throw new Exception(
  36. " This is not possible to be called for standalone input. Please check your platform and code where this is called");
  37. }
  38. public override void SetAxisNegative(string name)
  39. {
  40. throw new Exception(
  41. " This is not possible to be called for standalone input. Please check your platform and code where this is called");
  42. }
  43. public override void SetAxisZero(string name)
  44. {
  45. throw new Exception(
  46. " This is not possible to be called for standalone input. Please check your platform and code where this is called");
  47. }
  48. public override void SetAxis(string name, float value)
  49. {
  50. throw new Exception(
  51. " This is not possible to be called for standalone input. Please check your platform and code where this is called");
  52. }
  53. public override Vector3 MousePosition()
  54. {
  55. return Input.mousePosition;
  56. }
  57. }
  58. }