Skip to content

Commit 688e8f3

Browse files
committed
优化InputSystemPanel
1 parent dd8201a commit 688e8f3

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

CrazyCar/Assets/Scripts/Game/GameCtrBtn.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,17 @@
88
public class GameCtrBtn : MonoBehaviour, IPointerDownHandler, IPointerUpHandler {
99
private Action clickDown;
1010
private Action clickUp;
11-
private bool isClickDown = false;
12-
13-
private void Update() {
14-
if (isClickDown) {
15-
clickDown?.Invoke();
16-
}
17-
}
1811

1912
public void SetClick(Action clickDown = null, Action clickUp = null) {
2013
this.clickDown = clickDown;
2114
this.clickUp = clickUp;
2215
}
2316

2417
public void OnPointerDown(PointerEventData eventData) {
25-
isClickDown = true;
18+
clickDown?.Invoke();
2619
}
2720

2821
public void OnPointerUp(PointerEventData eventData) {
29-
isClickDown = false;
3022
clickUp?.Invoke();
3123
}
3224
}

0 commit comments

Comments
 (0)