ND_SimulationAutomaticControl/Assets/Scripts/Line/WireData.cs

28 lines
698 B
C#

// 扩展的连线数据类,包含吸附信息
using UnityEngine;
public class WireData : MonoBehaviour
{
public Vector3 startPoint;
public Vector3 endPoint;
public System.DateTime creationTime;
[Header("吸附信息")]
public GameObject snapStartObject; // 起点吸附的物体
public GameObject snapEndObject; // 终点吸附的物体
[Header("电气属性")]
public float resistance = 0.1f;
public bool isConnected = false;
// 连线编辑功能
public void UpdateEndPoint(Vector3 newEndPoint)
{
endPoint = newEndPoint;
LineRenderer lr = GetComponent<LineRenderer>();
if (lr != null)
{
lr.SetPosition(1, newEndPoint);
}
}
}