aboutsummaryrefslogtreecommitdiff
path: root/Assets/Scripts/InputHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts/InputHandler.cs')
-rw-r--r--Assets/Scripts/InputHandler.cs18
1 files changed, 15 insertions, 3 deletions
diff --git a/Assets/Scripts/InputHandler.cs b/Assets/Scripts/InputHandler.cs
index 9d2ab72..e1c70d0 100644
--- a/Assets/Scripts/InputHandler.cs
+++ b/Assets/Scripts/InputHandler.cs
@@ -28,6 +28,10 @@ namespace DS
[Tooltip("鼠标或右摇杆的垂直移动增量")]
public float mouseY;
+ public bool b_Input;
+ public bool rollFlag;
+ public bool isInteracting;
+
[Header("其他操作输入")]
[Tooltip("翻滚是否触发")]
public bool rollTriggered;
@@ -81,9 +85,6 @@ namespace DS
_inputActions.PlayerMovement.Camera.performed +=
ctx => _cameraInput = ctx.ReadValue<Vector2>();
- // 增加翻滚行为
- _inputActions.PlayerMovement.Roll.performed +=
- ctx => rollTriggered = ctx.ReadValueAsButton();
}
// 启用输入动作监听
@@ -107,6 +108,7 @@ namespace DS
public void TickInput(float delta)
{
MoveInput(delta);
+ HandleRollInput(delta);
}
// ===== 私有输入处理逻辑 =====
@@ -128,5 +130,15 @@ namespace DS
mouseX = _cameraInput.x;
mouseY = _cameraInput.y;
}
+
+ private void HandleRollInput(float delta)
+ {
+ b_Input = _inputActions.PlayerActions.Roll.phase == UnityEngine.InputSystem.InputActionPhase.Performed;
+ Debug.Log(b_Input);
+ if (b_Input)
+ {
+ rollFlag = true;
+ }
+ }
}
}