using System.Collections; using UnityEngine; class InputModule : MonoBehaviour { Vector3 vec3; Vector2 vec2; void Start() { //鼠标位置 vec3 = Input.mousePosition; //鼠标滚轮 vec2 = Input.mouseScrollDelta; Input.GetAxis("Mouse ScrollWheel"); //鼠标点击状态(持续) Input.GetMouseButton(2); //鼠标点击按下(瞬间) Input.GetMouseButtonDown(1); //鼠标点击抬起(瞬间) Input.GetMouseButtonUp(0); //鼠标滑动 Input.GetAxis("Mouse X"); Input.GetAxis("Mouse Y"); //触摸输入 Input.multiTouchEnabled = true; Input.simulateMouseWithTouches = true; int touch = Input.touchCount; Touch[] tou = Input.touches; bool suppor = Input.touchSupported; Input.GetTouch(1); //键盘输入 //返回float区间[-1,1] Input.GetAxis("Horizontal"); Input.GetAxis("Vertical"); //返回端点值(-1,0,1); Input.GetAxisRaw("Horizontal"); Input.GetAxisRaw("Vertical"); //按下状态(持续) //Input.GetKey(KeyCode / string); //按下状态(瞬间) //Input.GetKeyDown(KeyCode / string); //抬起状态(瞬间) //Input.GetKeyUp(KeyCode / string); } }
InputModule
最新推荐文章于 2022-04-01 10:00:20 发布