refactor(): 使用第一人称射线检测来替换掉 可交互和可编辑种重合的部分

This commit is contained in:
2025-10-18 17:14:09 +08:00
parent b709d1219f
commit 462a3b5850
6 changed files with 161 additions and 93 deletions

View File

@@ -5,9 +5,10 @@ using Interface;
namespace Script.Gameplay.Facility
{
public class DoorInteractController : InteractableBaseController, IEditableComponent
public class DoorInteractController : IInteractable, IEditableComponent
{
[SerializeField] private bool isActive = true;
public bool Interactable = true;
public bool IsActive
{
get => isActive;
@@ -21,8 +22,13 @@ namespace Script.Gameplay.Facility
public string ComponentName { get; set; } = "DoorSwitch";
public LockLevel LockLevel => LockLevel.Red;
private bool isOpened = false;
public string GetInteractPrompt()
{
return "按F进行交互";
}
public override void Interact(GameObject interactor)
public void Interact(GameObject interactor)
{
if (!Interactable) return;
if (isOpened)
@@ -37,6 +43,16 @@ namespace Script.Gameplay.Facility
}
}
public void OnGazeEnter(GameObject editor)
{
throw new NotImplementedException();
}
public void OnGazeExit(GameObject editor)
{
throw new NotImplementedException();
}
private void OpenDoor()
{
Debug.Log("Open door");