ScrollWheel









How do I use Scroll Wheel
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: RPGCamera.cs Copy
38     void UpdateDistance()
39     {
40         m_Distance = Mathf.Clamp( m_Distance - Input.GetAxis( "Mouse ScrollWheel" ) * ScrollModifier, MinimumDistance, MaximumDistance );
41     }
File name: InputManager.cs Copy
39  void Update() {
40   mouseAxis.x = Input.GetAxis("Mouse X");
41   mouseAxis.y = Input.GetAxis("Mouse Y");
42
43   if (InputEvent == null) return;
44
45   if (!GameManager.Instance.IsReady) return;
46
47   HighlightTile();
48
49   if (Input.GetMouseButtonUp(0)) {
50    if (GameManager.Instance.GameState.IsWaiting) {
51     UnHighlightTile();
52     InputEvent(InputActionType.GRAB_PIECE);
53    } else if (GameManager.Instance.GameState.IsHolding) {
54     InputEvent(InputActionType.PLACE_PIECE);
55    }
56   }
57
58   if (Input.GetMouseButtonUp(1)) {
59    if (GameManager.Instance.GameState.IsHolding) {
60     InputEvent(InputActionType.CANCEL_PIECE);
61    }
62   }
63
64   if (Input.GetAxis("Mouse ScrollWheel") > 0) {
65    InputEvent(InputActionType.ZOOM_IN);
66   }
67
68   if (Input.GetAxis("Mouse ScrollWheel") < 0) {
69    InputEvent(InputActionType.ZOOM_OUT);
70   }
71
72   if (Input.GetMouseButtonDown(2)) {
73    InputEvent(InputActionType.ROTATE);
74   } else if (Input.GetMouseButtonUp(2)) {
75    InputEvent(InputActionType.STOP_ROTATE);
76   }
77  }

ScrollWheel 149 lượt xem

Gõ tìm kiếm nhanh...