chore():整理了一下文件夹和玩家的血量逻辑

This commit is contained in:
2025-10-18 15:41:43 +08:00
parent ab403fac4b
commit b709d1219f
17 changed files with 214 additions and 33 deletions

View File

@@ -19,15 +19,25 @@ namespace Script.Gameplay.Input
private bool _hasFocus = true;
private void Awake()
protected override void Awake()
{
Input = new PlayerInputActions();
base.Awake();
}
private void OnEnable()
{
Input.Enable();
}
private void OnDisable()
{
// 可选:取消注册以防止重复订阅(简单项目可不解除)
Input.Disable();
}
private void Start()
{
// 注册事件
Input.Player.Move.performed += ctx => Move = ctx.ReadValue<Vector2>();
Input.Player.Move.canceled += ctx => Move = Vector2.zero;
@@ -46,16 +56,11 @@ namespace Script.Gameplay.Input
Input.Player.Edit.performed += ctx => EditPressed = true;
Input.Player.Edit.canceled += ctx => EditPressed = false;
}
private void OnDisable()
{
// 可选:取消注册以防止重复订阅(简单项目可不解除)
Input.Disable();
}
private void Start()
{
SetCursorState(false, CursorLockMode.Locked);
SetInputForLook(true);
SetInputForMove(true);
UIManager.Instance.RegisterInputManager(this);
}