feat(Cycle):实现循环提前检测,修复交互提示消失,按键绑定的事件在重启的时候没能正确,触发循环的提前检测有错误

This commit is contained in:
2025-10-27 10:31:01 +08:00
parent e8b9f47067
commit 9646483fa6
36 changed files with 6743 additions and 5221 deletions

View File

@@ -5,6 +5,7 @@ using Script.Gameplay.Input;
using System;
using System.Collections.Generic;
using Script.Gameplay.Global;
using UnityEngine.InputSystem;
namespace Script.Gameplay.Player
{
@@ -48,7 +49,7 @@ namespace Script.Gameplay.Player
void Start()
{
inputManager = InputManager.Instance;
inputManager.Input.Player.Edit.performed += context => EditTarget();
inputManager.Input.Player.Edit.performed += OnEditOnperformed;
timePauseManager = TimePauseManager.Instance;
if (raycaster == null)
raycaster = GetComponent<FirstPersonRaycaster>() ?? GetComponentInChildren<FirstPersonRaycaster>();
@@ -59,6 +60,11 @@ namespace Script.Gameplay.Player
ControllerLocator.Instance.Register(this);
}
private void OnEditOnperformed(InputAction.CallbackContext context)
{
EditTarget();
}
void Update()
{
DetectInteractable();
@@ -110,6 +116,15 @@ namespace Script.Gameplay.Player
}
}
private void OnDestroy()
{
if (inputManager != null)
{
inputManager.Input.Player.Edit.performed -= OnEditOnperformed;
}
ControllerLocator.Instance.Unregister(this);
}
void OnDrawGizmos()
{
// 交由 FirstPersonRaycaster 绘制射线