diff --git a/Assets/Script/Gameplay/Connect/ConnectionLineManager.cs b/Assets/Script/Gameplay/Connect/ConnectionLineManager.cs index cf49f7d..464ecd7 100644 --- a/Assets/Script/Gameplay/Connect/ConnectionLineManager.cs +++ b/Assets/Script/Gameplay/Connect/ConnectionLineManager.cs @@ -26,6 +26,16 @@ namespace Script.Gameplay.Connect public ConnectionLine GenerateConnectionLine(IConnectable a, IConnectable b) { + // 先检测 a b 点是否已经存在连接线 + foreach (var aline in a.ConnectionLines) + { + if (aline.PointA.GetGameObject() == b.GetGameObject() || aline.PointB.GetGameObject() == b.GetGameObject()) + { + Debug.Log("ab点间已经存在连接线"); + return null; + } + } + GameObject lineObject = Instantiate(linePrefab, this.transform); ConnectionLine connectionLine = lineObject.GetComponent(); if (connectionLine != null) diff --git a/Assets/Script/Gameplay/Player/PlayerConnectController.cs b/Assets/Script/Gameplay/Player/PlayerConnectController.cs index ddc1602..33e5e67 100644 --- a/Assets/Script/Gameplay/Player/PlayerConnectController.cs +++ b/Assets/Script/Gameplay/Player/PlayerConnectController.cs @@ -157,7 +157,7 @@ namespace Script.Gameplay.Player return; } // 创建连接线 - ConnectionLine connectionLine = ConnectionLineManager.Instance.GenerateConnectionLine(outTarget, inputTarget); + ConnectionLineManager.Instance.GenerateConnectionLine(outTarget, inputTarget); // 重置信号目标 outTarget = null;