fix(ConnectionLine):修复AB两点重复连接,有多条连接线,触发重启的BUG
This commit is contained in:
@@ -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<ConnectionLine>();
|
||||
if (connectionLine != null)
|
||||
|
||||
Reference in New Issue
Block a user