feat(CutLine): 实现切除连接线的逻辑

This commit is contained in:
2025-10-20 10:33:00 +08:00
parent 5dd9760a20
commit 2b4a7af1e1
7 changed files with 65 additions and 14 deletions

View File

@@ -27,6 +27,7 @@ namespace Script.Gameplay.Player
inputManager.Input.Player.SetOutput.performed += ctx => SetOutTarget(currentTarget);
inputManager.Input.Player.SetInput.performed += ctx => SetInputTarget(currentTarget);
inputManager.Input.Player.Connect.performed += ctx => CreateConnection();
inputManager.Input.Player.CutLine.performed += ctx => CutConnectLine(currentTarget);
if (raycaster == null)
raycaster = GetComponent<FirstPersonRaycaster>() ?? GetComponentInChildren<FirstPersonRaycaster>();
@@ -97,6 +98,14 @@ namespace Script.Gameplay.Player
}
}
public void CutConnectLine(IConnectable target)
{
if (target == null) return;
if(target.OutputConnectionLine != null && target.InputConnectionLine != null) return;
target.OutputConnectionLine?.DeleteConnection();
target.InputConnectionLine?.DeleteConnection();
}
private void CreateConnection()
{
if(!IsEnableConnecting) return;