连线功能

This commit is contained in:
lujiajian 2025-11-26 10:58:58 +08:00
parent a42408f7d2
commit 22c6c1fb6c
8 changed files with 4109 additions and 2749 deletions

View File

@ -1541,7 +1541,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 728892217} m_GameObject: {fileID: 728892217}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: -0.0361}
m_LocalScale: {x: 0.01, y: 0.01, z: 0.01} m_LocalScale: {x: 0.01, y: 0.01, z: 0.01}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
@ -1595,6 +1595,7 @@ MonoBehaviour:
requireColliderForConnection: 1 requireColliderForConnection: 1
addColliderToWires: 0 addColliderToWires: 0
currentState: 0 currentState: 0
snapTargetOriginalColor: {r: 0.8509804, g: 0.7137255, b: 0.40392157, a: 1}
LineModel: {fileID: 928431830} LineModel: {fileID: 928431830}
connectionPointPrefab: {fileID: 928431830} connectionPointPrefab: {fileID: 928431830}
connectionPointScale: 0.005 connectionPointScale: 0.005
@ -1602,6 +1603,11 @@ MonoBehaviour:
snapPreviewPrefab: {fileID: 928431830} snapPreviewPrefab: {fileID: 928431830}
deleteKey: 324 deleteKey: 324
deleteDetectionRadius: 0.5 deleteDetectionRadius: 0.5
verticalOffset: 0.005
enableStacking: 1
maxStackCount: 2
maxStackWarningColor: {r: 0.8509804, g: 0.7137255, b: 0.40392157, a: 1}
selfConnectionWarningColor: {r: 0.8509804, g: 0.7137255, b: 0.40392157, a: 1}
--- !u!4 &762882027 --- !u!4 &762882027
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1629,6 +1635,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 965acbac4940e4f4bb1f61e61ae6a732, type: 3} m_Script: {fileID: 11500000, guid: 965acbac4940e4f4bb1f61e61ae6a732, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
point1: {fileID: 0}
point2: {fileID: 0}
--- !u!1 &768640146 --- !u!1 &768640146
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2035,6 +2043,19 @@ GameObject:
m_CorrespondingSourceObject: {fileID: -7107844675581440747, guid: db6a5a541221af949b28431ba95977c1, type: 3} m_CorrespondingSourceObject: {fileID: -7107844675581440747, guid: db6a5a541221af949b28431ba95977c1, type: 3}
m_PrefabInstance: {fileID: 577406949} m_PrefabInstance: {fileID: 577406949}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!65 &928431834
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 928431830}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.5912819, y: 1.0420685, z: 2.5101469}
m_Center: {x: 0, y: 0.0000038146973, z: 0}
--- !u!1 &943655338 --- !u!1 &943655338
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -4734,6 +4755,24 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
interfaceType: 35 interfaceType: 35
--- !u!1 &1927749092 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4652463430070362293, guid: db6a5a541221af949b28431ba95977c1, type: 3}
m_PrefabInstance: {fileID: 577406949}
m_PrefabAsset: {fileID: 0}
--- !u!65 &1927749096
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1927749092}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.5912819, y: 1.0420685, z: 2.5101469}
m_Center: {x: 0, y: 0.0000038146973, z: 0}
--- !u!1 &1935289277 --- !u!1 &1935289277
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 连接点接口引用组件,用于关联连接点和目标接口
/// </summary>
public class ConnectionPointInterfaceReference : MonoBehaviour
{
public GameObject targetInterface; // 目标接口对象
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 857de14d89f0a4b41bacc2ec61446c7c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -51,4 +51,9 @@ public class LineConnect : MonoBehaviour
{ {
LineManager.instance.ClickPoint(transform); LineManager.instance.ClickPoint(transform);
} }
private void Update()
{
}
} }

View File

@ -5,8 +5,8 @@ using UnityEngine;
public class LineManager : MonoBehaviour public class LineManager : MonoBehaviour
{ {
public static LineManager instance; public static LineManager instance;
private Transform point1; public Transform point1;
private Transform point2; public Transform point2;
private void Awake() private void Awake()
{ {
instance = this; instance = this;
@ -33,5 +33,21 @@ public class LineManager : MonoBehaviour
{ {
point1 = point; point1 = point;
} }
if (point1 != null && point2 != null)
{
Checkconnection(point1, point2);
}
}
public void Checkconnection(Transform transform, Transform transform2)
{
}
public void Init()
{
point2 = null;
point1 = null;
} }
} }

View File

@ -1,11 +1,13 @@
// 扩展的连线数据类,包含吸附信息
using UnityEngine;
using UnityEngine;
/// <summary>
/// 连线数据组件,附加到连线对象上存储连线信息
/// </summary>
public class WireData : MonoBehaviour public class WireData : MonoBehaviour
{ {
public Vector3 startPoint; public Vector3 startPoint; // 连线起点位置
public Vector3 endPoint; public Vector3 endPoint; // 连线终点位置
public System.DateTime creationTime; public System.DateTime creationTime; // 连线创建时间
[Header("吸附信息")] [Header("吸附信息")]
public GameObject snapStartObject; // 起点吸附的物体 public GameObject snapStartObject; // 起点吸附的物体

File diff suppressed because it is too large Load Diff