连线功能提交

This commit is contained in:
lujiajian 2025-11-24 18:01:48 +08:00
parent e322e2fa99
commit a42408f7d2
22 changed files with 12236 additions and 5 deletions

5374
Assets/Scenes/Line.unity Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 7d6840ddc6d7306468b484dc6798b47a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

8
Assets/Scripts/Line.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d87b0629e71a5314294399c714f1eddf
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,80 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Line
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f05971417d224144197deec4549ccc4f
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,54 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public enum InterfaceType
{
None,
IN1,
IN1_100K,
IN2,
IN2_200K,
IN3,
IN3_200K,
IN4,
_12V,//+12V
GND,
GND1,
GND2,
GND3,
__12V,//-12V
UI,
UI_100K,
UI_01uF,
UI_1uF,
UI_10uF,
O1_01uF,
O1_1uF,
O1_10uF,
OUT1,
OUT2,
O1,
O2,
_1uF_star,
_1uF_end,
_10uF_star,
_10uF_end,
_51K_star,
_51K_end,
_100K_star,
_100K_end,
_200K_star,
_200K_end,
_250K_star,
_250K_end,
}
public class LineConnect : MonoBehaviour
{
public InterfaceType interfaceType = InterfaceType.None;
private void OnMouseDown()
{
LineManager.instance.ClickPoint(transform);
}
}

View File

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

View File

@ -0,0 +1,37 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LineManager : MonoBehaviour
{
public static LineManager instance;
private Transform point1;
private Transform point2;
private void Awake()
{
instance = this;
}
void Start()
{
}
void Update()
{
}
/// <summary>
/// Êó±êµã»÷µÄÎïÌå
/// </summary>
/// <param name="point"></param>
public void ClickPoint(Transform point)
{
if (point1 != null)
{
point2 = point;
}
if (point1 == null)
{
point1 = point;
}
}
}

View File

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

View File

@ -0,0 +1,28 @@
// 扩展的连线数据类,包含吸附信息
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);
}
}
}

View File

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

View File

@ -0,0 +1,900 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class WireDrawingSystem : MonoBehaviour
{
public enum DrawingState
{
Idle, // 空闲状态
SelectingStart, // 选择起点
SelectingEnd // 选择终点
}
[Header("连线设置")]
public Material wireMaterial;
public Color wireColor = Color.red;
public float wireWidth = 0.02f;
[Header("吸附设置")]
public bool enableSnapping = true; // 启用吸附功能
public float snapDistance = 1.0f; // 吸附距离
public LayerMask snapLayers = -1; // 可吸附的层
public bool snapToColliderCenter = true; // 吸附到碰撞体中心
public bool snapToTransformCenter = false; // 吸附到变换组件中心
public Color snapHighlightColor = Color.cyan; // 吸附高亮颜色
[Header("碰撞设置")]
public bool requireColliderForConnection = true; // 要求物体必须有碰撞体才能连线
public bool addColliderToWires = false; // 是否为连线添加碰撞器
[Header("状态显示")]
public DrawingState currentState = DrawingState.Idle;
// 连线数据
private Vector3 startPoint;
private Vector3 endPoint;
private LineRenderer currentWire;
private GameObject currentWireObject;
// 吸附相关
private GameObject snapTarget; // 当前吸附目标
private Renderer snapTargetRenderer; // 吸附目标的渲染器
private Color snapTargetOriginalColor; // 吸附目标原始颜色
// 修复问题:记录鼠标点击的实际位置
private Vector3 actualMousePosition;
/// <summary>
/// 接线头样式
/// </summary>
[Header("接线头样式")]
public GameObject LineModel;
[Header("连接点模型设置")]
public GameObject connectionPointPrefab; // 连接点模型预制体
public float connectionPointScale = 0.1f; // 连接点模型缩放
public Material connectionPointMaterial; // 连接点材质
[Header("吸附点预览")]
public GameObject snapPreviewPrefab; // 吸附点预览预制体
private GameObject currentSnapPreview; // 当前吸附点预览
private List<GameObject> connectionPoints = new List<GameObject>(); // 存储所有连接点
[Header("删除设置")]
public KeyCode deleteKey = KeyCode.Mouse1; // 默认为鼠标右键
public float deleteDetectionRadius = 0.5f; // 删除检测半径
// 存储所有已创建的连线和连接点
private List<GameObject> allWires = new List<GameObject>();
private List<GameObject> allConnectionPoints = new List<GameObject>();
void Update()
{
HandleInput();
UpdateWirePreview();
// 在选择终点状态时检查吸附
if (currentState == DrawingState.SelectingEnd && enableSnapping)
{
CheckForSnapTargets();
UpdateSnapPreview();
}
else
{
// 不在选择终点状态时,清除吸附点预览
ClearSnapPreview();
}
}
/// <summary>
/// 在指定位置创建连接点模型
/// </summary>
/// <param name="position">连接点位置</param>
/// <param name="isStartPoint">是否为起点</param>
// 修改现有的创建连接点方法,添加记录功能
void CreateConnectionPoint(Vector3 position, bool isStartPoint)
{
if (connectionPointPrefab == null)
{
Debug.LogWarning("连接点预制体未设置,无法创建连接点模型");
return;
}
GameObject connectionPoint = Instantiate(connectionPointPrefab);
connectionPoint.name = $"ConnectionPoint_{(isStartPoint ? "Start" : "End")}_{System.DateTime.Now:HHmmss}";
connectionPoint.transform.position = position;
connectionPoint.transform.localScale = Vector3.one * connectionPointScale;
// 设置材质
if (connectionPointMaterial != null)
{
Renderer renderer = connectionPoint.GetComponent<Renderer>();
if (renderer != null)
{
renderer.material = connectionPointMaterial;
}
}
// 添加到连接点列表
allConnectionPoints.Add(connectionPoint);
Debug.Log($"创建连接点: {position}, 类型: {(isStartPoint ? "" : "")}");
}
/// <summary>
/// 删除未完成的连接点(用于取消操作时)
/// </summary>
void RemoveUnfinishedConnectionPoints()
{
// 删除最近创建但未完成的连接点
if (allConnectionPoints.Count > 0)
{
// 查找未附加到连线的连接点
List<GameObject> toRemove = new List<GameObject>();
foreach (GameObject point in allConnectionPoints)
{
if (point != null && point.transform.parent == null)
{
toRemove.Add(point);
}
}
// 删除这些连接点
foreach (GameObject point in toRemove)
{
allConnectionPoints.Remove(point);
Destroy(point);
}
}
}
/// <summary>
/// 清除所有连接点
/// </summary>
public void ClearAllConnectionPoints()
{
foreach (GameObject point in connectionPoints)
{
if (point != null)
Destroy(point);
}
connectionPoints.Clear();
}
/// <summary>
/// 删除所有连线和连接点
/// </summary>
public void ClearAll()
{
// 删除所有连线
foreach (GameObject wire in allWires)
{
if (wire != null)
Destroy(wire);
}
allWires.Clear();
// 删除所有连接点
foreach (GameObject point in allConnectionPoints)
{
if (point != null)
Destroy(point);
}
allConnectionPoints.Clear();
// 清除吸附点预览
ClearSnapPreview();
Debug.Log("已清除所有连线和连接点");
}
/// <summary>
/// 将连接点附加到连线对象上
/// </summary>
/// <param name="wireObject">连线对象</param>
void AttachConnectionPointsToWire(GameObject wireObject)
{
// 查找最近创建的两个未附加的连接点
List<GameObject> unattachedPoints = new List<GameObject>();
foreach (GameObject point in allConnectionPoints)
{
if (point != null && point.transform.parent == null)
{
unattachedPoints.Add(point);
}
}
// 将最近的两个连接点附加到连线
if (unattachedPoints.Count >= 2)
{
for (int i = unattachedPoints.Count - 1; i >= Mathf.Max(0, unattachedPoints.Count - 2); i--)
{
unattachedPoints[i].transform.SetParent(wireObject.transform);
}
}
}
void HandleInput()
{
if (Input.GetMouseButtonDown(0)) // 左键点击
{
HandleMouseClick();
}
if (Input.GetKeyDown(KeyCode.Escape))// 取消当前操作
{
CancelDrawing();
}
if (Input.GetMouseButtonDown(1))
{
HandleDelete();
}
}
/// <summary>
/// 处理删除操作
/// </summary>
void HandleDelete()
{
// 如果正在绘制连线,先取消绘制
if (currentState != DrawingState.Idle)
{
CancelDrawing();
return;
}
// 清除吸附点预览
ClearSnapPreview();
// 查找鼠标位置附近的连线和连接点
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit))
{
// 检查是否点击到了连线或连接点
GameObject hitObject = hit.collider.gameObject;
DeleteObjectIfWireOrConnection(hitObject);
}
else
{
// 如果没有击中任何物体,尝试删除最后一个创建的连线
DeleteLastWire();
}
}
/// <summary>
/// 删除指定的连线或连接点
/// </summary>
void DeleteObjectIfWireOrConnection(GameObject obj)
{
if (obj == null) return;
// 检查是否是吸附预览
if (obj.name == "SnapPreview")
{
ClearSnapPreview();
return;
}
// 检查是否是连线
if (obj.name.StartsWith("Wire_") || obj.GetComponent<LineRenderer>() != null)
{
DeleteWire(obj);
return;
}
// 检查是否是连接点
if (obj.name.StartsWith("ConnectionPoint_"))
{
DeleteConnectionPoint(obj);
return;
}
// 检查是否是连线的一部分(子物体)
if (obj.transform.parent != null)
{
GameObject parent = obj.transform.parent.gameObject;
if (parent.name.StartsWith("Wire_") || parent.GetComponent<LineRenderer>() != null)
{
DeleteWire(parent);
return;
}
}
}
/// <summary>
/// 删除指定的连线
/// </summary>
void DeleteWire(GameObject wireObject)
{
if (wireObject == null) return;
// 删除连线的所有连接点(子物体)
foreach (Transform child in wireObject.transform)
{
if (child.name.StartsWith("ConnectionPoint_"))
{
allConnectionPoints.Remove(child.gameObject);
Destroy(child.gameObject);
}
}
// 从列表中移除并销毁连线
allWires.Remove(wireObject);
Destroy(wireObject);
Debug.Log("删除连线: " + wireObject.name);
// 清除吸附点预览
ClearSnapPreview();
}
/// <summary>
/// 删除指定的连接点
/// </summary>
void DeleteConnectionPoint(GameObject connectionPoint)
{
if (connectionPoint == null) return;
// 从列表中移除并销毁连接点
allConnectionPoints.Remove(connectionPoint);
Destroy(connectionPoint);
Debug.Log("删除连接点: " + connectionPoint.name);
// 清除吸附点预览
ClearSnapPreview();
}
/// <summary>
/// 删除最后一个创建的连线
/// </summary>
void DeleteLastWire()
{
if (allWires.Count > 0)
{
GameObject lastWire = allWires[allWires.Count - 1];
DeleteWire(lastWire);
}
else
{
Debug.Log("没有可删除的连线");
}
}
/// <summary>
/// 删除最后一个连接点
/// </summary>
void DeleteLastConnectionPoint()
{
if (allConnectionPoints.Count > 0)
{
GameObject lastPoint = allConnectionPoints[allConnectionPoints.Count - 1];
DeleteConnectionPoint(lastPoint);
}
else
{
Debug.Log("没有可删除的连接点");
}
}
void HandleMouseClick()
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
// 获取鼠标的实际世界位置
actualMousePosition = GetMouseWorldPosition();
// 首先检查是否有吸附目标
if (snapTarget != null)
{
// 检查吸附目标是否有碰撞体
if (requireColliderForConnection && !HasCollider(snapTarget))
{
Debug.LogWarning($"目标物体 {snapTarget.name} 没有碰撞体,无法连线");
return;
}
// 如果有吸附目标,使用吸附点的位置
Vector3 targetPoint = GetObjectCenter(snapTarget);
switch (currentState)
{
case DrawingState.Idle:
StartNewWire(targetPoint);
break;
case DrawingState.SelectingStart:
break;
case DrawingState.SelectingEnd:
CompleteWire(targetPoint);
break;
}
}
else if (Physics.Raycast(ray, out hit, Mathf.Infinity, snapLayers))
{
// 检查击中的物体是否有碰撞体
if (requireColliderForConnection && !HasCollider(hit.collider.gameObject))
{
Debug.LogWarning($"目标物体 {hit.collider.gameObject.name} 没有碰撞体,无法连线");
return;
}
// 如果有击中物体,使用击中点的位置
Vector3 targetPoint = GetSnapPoint(hit);
switch (currentState)
{
case DrawingState.Idle:
StartNewWire(targetPoint);
break;
case DrawingState.SelectingStart:
break;
case DrawingState.SelectingEnd:
CompleteWire(targetPoint);
break;
}
}
else
{
// 如果没有击中任何物体,且要求必须有碰撞体,则不允许连线
if (requireColliderForConnection)
{
Debug.LogWarning("没有找到带有碰撞体的物体,无法连线");
return;
}
// 如果没有击中任何物体,使用实际鼠标位置
switch (currentState)
{
case DrawingState.Idle:
StartNewWire(actualMousePosition);
break;
case DrawingState.SelectingStart:
break;
case DrawingState.SelectingEnd:
CompleteWire(actualMousePosition);
break;
}
}
}
// 检查物体是否有碰撞体
bool HasCollider(GameObject obj)
{
if (obj == null) return false;
// 检查所有类型的碰撞器
Collider collider3D = obj.GetComponent<Collider>();
Collider2D collider2D = obj.GetComponent<Collider2D>();
return (collider3D != null || collider2D != null);
}
void StartNewWire(Vector3 point)
{
startPoint = point;
currentState = DrawingState.SelectingEnd;
// 在这里添加:创建起点连接点模型
CreateConnectionPoint(point, true);
// 创建连线预览
CreateWirePreview();
Debug.Log("选择起点: " + point);
}
void CompleteWire(Vector3 point)
{
endPoint = point;
currentState = DrawingState.Idle;
// 在这里添加:创建终点连接点模型
CreateConnectionPoint(point, false);
// 完成连线
FinalizeWire();
Debug.Log("选择终点: " + point);
Debug.Log($"连线完成: {startPoint} -> {endPoint}");
// 清除吸附高亮
ClearSnapHighlight();
}
void CreateWirePreview()
{
currentWireObject = new GameObject("WirePreview");
currentWire = currentWireObject.AddComponent<LineRenderer>();
ConfigureLineRenderer(currentWire);
currentWire.positionCount = 2;
currentWire.SetPosition(0, startPoint);
currentWire.SetPosition(1, startPoint); // 初始时终点与起点相同
}
void UpdateWirePreview()
{
if (currentState == DrawingState.SelectingEnd && currentWire != null)
{
Vector3 targetPoint;
// 如果有吸附目标,使用吸附点
if (snapTarget != null)
{
targetPoint = GetObjectCenter(snapTarget);
}
else
{
// 否则使用实际鼠标位置
targetPoint = GetMouseWorldPosition();
}
currentWire.SetPosition(1, targetPoint);
}
}
void CheckForSnapTargets()
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
// 清除之前的吸附高亮
ClearSnapHighlight();
// 检查鼠标位置附近是否有可吸附的物体
if (Physics.Raycast(ray, out hit, Mathf.Infinity, snapLayers))
{
GameObject hitObject = hit.collider.gameObject;
// 如果要求碰撞体但物体没有碰撞体,跳过
if (requireColliderForConnection && !HasCollider(hitObject))
{
return;
}
// 计算鼠标位置与物体中心的距离
Vector3 objectCenter = GetObjectCenter(hitObject);
float distance = Vector3.Distance(GetMouseWorldPosition(), objectCenter);
if (distance <= snapDistance)
{
// 设置吸附目标
snapTarget = hitObject;
// 高亮显示可吸附的物体
HighlightSnapTarget(snapTarget);
}
}
}
Vector3 GetSnapPoint(RaycastHit hit)
{
if (!enableSnapping)
return hit.point;
GameObject hitObject = hit.collider.gameObject;
Vector3 objectCenter = GetObjectCenter(hitObject);
// 检查是否在吸附距离内
float distance = Vector3.Distance(hit.point, objectCenter);
if (distance <= snapDistance)
{
return objectCenter;
}
return hit.point;
}
Vector3 GetObjectCenter(GameObject obj)
{
if (snapToColliderCenter)
{
Collider collider = obj.GetComponent<Collider>();
if (collider != null)
{
return collider.bounds.center;
}
}
if (snapToTransformCenter)
{
return obj.transform.position;
}
// 默认使用碰撞体中心
Collider defaultCollider = obj.GetComponent<Collider>();
if (defaultCollider != null)
{
return defaultCollider.bounds.center;
}
// 如果都没有,使用变换位置
return obj.transform.position;
}
void HighlightSnapTarget(GameObject target)
{
snapTargetRenderer = target.GetComponent<Renderer>();
if (snapTargetRenderer != null)
{
snapTargetOriginalColor = snapTargetRenderer.material.color;
snapTargetRenderer.material.color = snapHighlightColor;
}
}
void ClearSnapHighlight()
{
if (snapTargetRenderer != null)
{
snapTargetRenderer.material.color = snapTargetOriginalColor;
snapTargetRenderer = null;
}
snapTarget = null;
}
// 修改 FinalizeWire 方法,添加记录功能
void FinalizeWire()
{
if (currentWire != null)
{
currentWireObject.name = $"Wire_{System.DateTime.Now:yyyyMMddHHmmss}";
// 将连接点附加到连线对象
AttachConnectionPointsToWire(currentWireObject);
// 添加到连线列表
allWires.Add(currentWireObject);
// 可选:添加物理碰撞器
if (addColliderToWires)
{
AddWireCollider(currentWire);
}
// 保存连线数据
WireData data = currentWireObject.AddComponent<WireData>();
data.startPoint = startPoint;
data.endPoint = endPoint;
data.creationTime = System.DateTime.Now;
if (snapTarget != null)
{
data.snapEndObject = snapTarget;
}
}
currentWire = null;
currentWireObject = null;
}
// 修改 CancelDrawing 方法,确保正确清理
void CancelDrawing()
{
if (currentWireObject != null)
{
Destroy(currentWireObject);
}
// 删除未完成的连接点
RemoveUnfinishedConnectionPoints();
// 清除吸附点预览
ClearSnapPreview();
currentState = DrawingState.Idle;
currentWire = null;
currentWireObject = null;
ClearSnapHighlight();
Debug.Log("取消连线操作");
}
/// <summary>
/// 更新吸附点预览模型
/// </summary>
void UpdateSnapPreview()
{
if (snapPreviewPrefab == null) return;
// 如果有吸附目标,显示预览
if (snapTarget != null)
{
if (currentSnapPreview == null)
{
currentSnapPreview = Instantiate(snapPreviewPrefab);
currentSnapPreview.name = "SnapPreview";
currentSnapPreview.transform.localScale = Vector3.one * connectionPointScale * 0.8f;
// 设置为半透明
Renderer renderer = currentSnapPreview.GetComponent<Renderer>();
if (renderer != null)
{
Color color = renderer.material.color;
color.a = 0.5f;
renderer.material.color = color;
}
}
Vector3 snapPosition = GetObjectCenter(snapTarget);
currentSnapPreview.transform.position = snapPosition;
}
else if (currentSnapPreview != null)
{
// 没有吸附目标时隐藏预览
ClearSnapPreview();
}
}
/// <summary>
/// 清除吸附点预览
/// </summary>
void ClearSnapPreview()
{
if (currentSnapPreview != null)
{
Destroy(currentSnapPreview);
currentSnapPreview = null;
}
}
void ConfigureLineRenderer(LineRenderer lr)
{
if (wireMaterial != null)
{
lr.material = wireMaterial;
}
else
{
// 使用默认材质
lr.material = new Material(Shader.Find("Sprites/Default"));
}
lr.startColor = wireColor;
lr.endColor = wireColor;
lr.startWidth = wireWidth;
lr.endWidth = wireWidth;
lr.useWorldSpace = true;
}
// 修复:改进的碰撞器添加方法
void AddWireCollider(LineRenderer lr)
{
if (lr.positionCount < 2)
{
Debug.LogWarning("连线点数不足,无法添加碰撞器");
return;
}
// 创建胶囊碰撞器而不是网格碰撞器避免Convex Mesh错误
CreateCapsuleCollidersAlongLine(lr);
}
// 修复:使用胶囊碰撞器替代网格碰撞器
void CreateCapsuleCollidersAlongLine(LineRenderer lr)
{
// 获取连线上的所有点
Vector3[] positions = new Vector3[lr.positionCount];
lr.GetPositions(positions);
// 为连线的每个线段创建胶囊碰撞器
for (int i = 0; i < positions.Length - 1; i++)
{
Vector3 start = positions[i];
Vector3 end = positions[i + 1];
// 计算线段长度和方向
float distance = Vector3.Distance(start, end);
if (distance < 0.01f) continue; // 跳过太短的线段
Vector3 direction = (end - start).normalized;
// 创建胶囊碰撞器
CapsuleCollider capsule = currentWireObject.AddComponent<CapsuleCollider>();
// 设置胶囊碰撞器的方向和位置
capsule.direction = 2; // Z轴方向
capsule.height = distance;
capsule.radius = wireWidth / 2;
// 计算胶囊的位置和旋转
capsule.center = start + direction * distance / 2;
// 设置胶囊的方向
if (direction != Vector3.zero)
{
capsule.transform.rotation = Quaternion.LookRotation(direction);
}
capsule.isTrigger = true;
}
}
// 修复:改进的鼠标位置获取方法
Vector3 GetMouseWorldPosition()
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
// 优先使用吸附目标的位置
if (snapTarget != null)
{
return GetObjectCenter(snapTarget);
}
// 其次使用射线击中的位置
if (Physics.Raycast(ray, out hit, Mathf.Infinity, snapLayers))
{
// 检查击中的物体是否有碰撞体
if (requireColliderForConnection && !HasCollider(hit.collider.gameObject))
{
// 如果没有碰撞体,继续寻找其他点
return FindAlternativePosition(ray);
}
return GetSnapPoint(hit);
}
// 如果没有击中任何物体,使用默认平面
return FindAlternativePosition(ray);
}
// 寻找替代位置(当没有碰撞体时)
Vector3 FindAlternativePosition(Ray ray)
{
// 尝试在默认平面上寻找位置
Plane defaultPlane = new Plane(Vector3.up, Vector3.zero);
float enter;
if (defaultPlane.Raycast(ray, out enter))
{
return ray.GetPoint(enter);
}
// 最后使用射线上的一个点
return ray.origin + ray.direction * 10f;
}
// 公共方法:开始新连线
public void StartNewWire()
{
if (currentState != DrawingState.Idle)
{
CancelDrawing();
}
currentState = DrawingState.SelectingStart;
}
// 公共方法:设置吸附目标(用于编程控制)
public void SetSnapTarget(GameObject target)
{
if (enableSnapping && target != null)
{
// 检查目标是否有碰撞体
if (requireColliderForConnection && !HasCollider(target))
{
Debug.LogWarning($"目标物体 {target.name} 没有碰撞体,无法设置为吸附目标");
return;
}
snapTarget = target;
HighlightSnapTarget(target);
}
}
// 公共方法:清除吸附目标
public void ClearSnapTarget()
{
ClearSnapHighlight();
}
// 公共方法:检查物体是否可以连线
public bool CanConnectToObject(GameObject obj)
{
if (obj == null) return false;
// 如果不需要碰撞体,任何物体都可以连线
if (!requireColliderForConnection) return true;
// 检查物体是否有碰撞体
return HasCollider(obj);
}
}

View File

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

View File

@ -0,0 +1,59 @@
// WireShader.shader
Shader "Custom/WireShader"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_Thickness ("Thickness", Range(0, 0.1)) = 0.02
}
SubShader
{
Tags { "RenderType"="Opaque" "Queue"="Geometry+1" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
};
struct v2f
{
float4 vertex : SV_POSITION;
UNITY_FOG_COORDS(0)
};
fixed4 _Color;
float _Thickness;
v2f vert (appdata v)
{
v2f o;
// 将顶点稍微向摄像机方向偏移,避免深度冲突
float3 viewPos = UnityObjectToViewPos(v.vertex);
viewPos.z -= _Thickness * 10; // 轻微深度偏移
o.vertex = UnityViewToClipPos(viewPos);
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 col = _Color;
UNITY_APPLY_FOG(i.fogCoord, col);
return col;
}
ENDCG
}
}
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 2c36822efece7ef49b9cef8877f0c3c4
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -4,5 +4,8 @@
EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes: []
m_Scenes:
- enabled: 1
path: Assets/Scenes/Line.unity
guid: 7d6840ddc6d7306468b484dc6798b47a
m_configObjects: {}

View File

@ -277,7 +277,99 @@ PlayerSettings:
AndroidValidateAppBundleSize: 1
AndroidAppBundleSizeToValidate: 150
m_BuildTargetIcons: []
m_BuildTargetPlatformIcons: []
m_BuildTargetPlatformIcons:
- m_BuildTarget: Android
m_Icons:
- m_Textures: []
m_Width: 432
m_Height: 432
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 324
m_Height: 324
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 216
m_Height: 216
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 162
m_Height: 162
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 108
m_Height: 108
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 81
m_Height: 81
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 192
m_Height: 192
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 144
m_Height: 144
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 96
m_Height: 96
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 72
m_Height: 72
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 48
m_Height: 48
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 36
m_Height: 36
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 192
m_Height: 192
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 144
m_Height: 144
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 96
m_Height: 96
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 72
m_Height: 72
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 48
m_Height: 48
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 36
m_Height: 36
m_Kind: 0
m_SubKind:
m_BuildTargetBatching:
- m_BuildTarget: Standalone
m_StaticBatching: 1
@ -339,7 +431,7 @@ PlayerSettings:
m_Automatic: 1
- m_BuildTarget: WebGLSupport
m_APIs: 0b000000
m_Automatic: 1
m_Automatic: 0
m_BuildTargetVRSettings:
- m_BuildTarget: Standalone
m_Enabled: 0
@ -622,7 +714,23 @@ PlayerSettings:
webGLThreadsSupport: 0
webGLDecompressionFallback: 0
webGLPowerPreference: 2
scriptingDefineSymbols: {}
scriptingDefineSymbols:
Android: DOTWEEN
EmbeddedLinux: DOTWEEN
GameCoreScarlett: DOTWEEN
GameCoreXboxOne: DOTWEEN
LinuxHeadlessSimulation: DOTWEEN
Lumin: DOTWEEN
Nintendo Switch: DOTWEEN
PS4: DOTWEEN
PS5: DOTWEEN
Stadia: DOTWEEN
Standalone: DOTWEEN
WebGL: DOTWEEN
Windows Store Apps: DOTWEEN
XboxOne: DOTWEEN
iPhone: DOTWEEN
tvOS: DOTWEEN
additionalCompilerArguments: {}
platformArchitecture: {}
scriptingBackend: {}

View File

@ -0,0 +1,121 @@
{
"templatePinStates": [],
"dependencyTypeInfos": [
{
"userAdded": false,
"type": "UnityEngine.AnimationClip",
"defaultInstantiationMode": 0
},
{
"userAdded": false,
"type": "UnityEditor.Animations.AnimatorController",
"defaultInstantiationMode": 0
},
{
"userAdded": false,
"type": "UnityEngine.AnimatorOverrideController",
"defaultInstantiationMode": 0
},
{
"userAdded": false,
"type": "UnityEditor.Audio.AudioMixerController",
"defaultInstantiationMode": 0
},
{
"userAdded": false,
"type": "UnityEngine.ComputeShader",
"defaultInstantiationMode": 1
},
{
"userAdded": false,
"type": "UnityEngine.Cubemap",
"defaultInstantiationMode": 0
},
{
"userAdded": false,
"type": "UnityEngine.GameObject",
"defaultInstantiationMode": 0
},
{
"userAdded": false,
"type": "UnityEditor.LightingDataAsset",
"defaultInstantiationMode": 0
},
{
"userAdded": false,
"type": "UnityEngine.LightingSettings",
"defaultInstantiationMode": 0
},
{
"userAdded": false,
"type": "UnityEngine.Material",
"defaultInstantiationMode": 0
},
{
"userAdded": false,
"type": "UnityEditor.MonoScript",
"defaultInstantiationMode": 1
},
{
"userAdded": false,
"type": "UnityEngine.PhysicMaterial",
"defaultInstantiationMode": 0
},
{
"userAdded": false,
"type": "UnityEngine.PhysicsMaterial2D",
"defaultInstantiationMode": 0
},
{
"userAdded": false,
"type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile",
"defaultInstantiationMode": 0
},
{
"userAdded": false,
"type": "UnityEngine.Rendering.PostProcessing.PostProcessResources",
"defaultInstantiationMode": 0
},
{
"userAdded": false,
"type": "UnityEngine.Rendering.VolumeProfile",
"defaultInstantiationMode": 0
},
{
"userAdded": false,
"type": "UnityEditor.SceneAsset",
"defaultInstantiationMode": 1
},
{
"userAdded": false,
"type": "UnityEngine.Shader",
"defaultInstantiationMode": 1
},
{
"userAdded": false,
"type": "UnityEngine.ShaderVariantCollection",
"defaultInstantiationMode": 1
},
{
"userAdded": false,
"type": "UnityEngine.Texture",
"defaultInstantiationMode": 0
},
{
"userAdded": false,
"type": "UnityEngine.Texture2D",
"defaultInstantiationMode": 0
},
{
"userAdded": false,
"type": "UnityEngine.Timeline.TimelineAsset",
"defaultInstantiationMode": 0
}
],
"defaultDependencyTypeInfo": {
"userAdded": false,
"type": "<default_scene_template_dependencies>",
"defaultInstantiationMode": 1
},
"newSceneOverride": 0
}

View File

@ -11,7 +11,7 @@ TagManager:
-
- Water
- UI
-
- chatou
-
-
-

View File

@ -5,6 +5,27 @@ EditorUserSettings:
m_ObjectHideFlags: 0
serializedVersion: 4
m_ConfigSettings:
RecentlyUsedSceneGuid-0:
value: 0250015457575a0d5a5b5b7514265e4410161b7a7b2a77687c704830b1e46139
flags: 0
RecentlyUsedSceneGuid-1:
value: 5a5757560101590a5d0c0e24427b5d44434e4c7a7b7a23677f2b4565b7b5353a
flags: 0
RecentlyUsedSceneGuid-2:
value: 5754060550000c5e59580a2348270d44434e1b782a7b7633747e1e30e4b5616b
flags: 0
RecentlyUsedSceneGuid-3:
value: 0609045307065a5d5a0d0874407b5944124f1e72787b2465287e1f36b0b8316f
flags: 0
RecentlyUsedSceneGuid-4:
value: 5100505107535102585c5a2441710644424f192c2a2e7e637e7a1e6ab7e3376c
flags: 0
RecentlyUsedSceneGuid-5:
value: 5550570754050f5f540a5f7716765d44444e497b2d7f22667a711830e4b76639
flags: 0
RecentlyUsedSceneGuid-6:
value: 5455025e51050d5f0e58087543730944404f1a7e747c22337b7e446be0b46339
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650
flags: 0

View File

@ -0,0 +1,942 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &1
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 1
m_Script: {fileID: 12010, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_Children:
- {fileID: 3}
- {fileID: 7}
- {fileID: 12}
m_Position:
serializedVersion: 2
x: 0
y: 30
width: 1920
height: 947
m_MinSize: {x: 400, y: 200}
m_MaxSize: {x: 32384, y: 16192}
vertical: 0
controlID: 42028
--- !u!114 &2
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 1
m_Script: {fileID: 12015, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_TitleContent:
m_Text: Game
m_Image: {fileID: -6423792434712278376, guid: 0000000000000000d000000000000000, type: 0}
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 0
y: 480
width: 876
height: 519
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
m_SaveData: []
m_OverlaysVisible: 1
m_SerializedViewNames: []
m_SerializedViewValues: []
m_PlayModeViewName: GameView
m_ShowGizmos: 1
m_TargetDisplay: 0
m_ClearColor: {r: 0, g: 0, b: 0, a: 0}
m_TargetSize: {x: 1920, y: 1080}
m_TextureFilterMode: 0
m_TextureHideFlags: 61
m_RenderIMGUI: 1
m_EnterPlayModeBehavior: 0
m_UseMipMap: 0
m_VSyncEnabled: 0
m_Gizmos: 1
m_Stats: 0
m_SelectedSizes: 03000000000000000000000000000000000000000000000000000000000000000000000000000000
m_ZoomArea:
m_HRangeLocked: 0
m_VRangeLocked: 0
hZoomLockedByDefault: 0
vZoomLockedByDefault: 0
m_HBaseRangeMin: -960
m_HBaseRangeMax: 960
m_VBaseRangeMin: -540
m_VBaseRangeMax: 540
m_HAllowExceedBaseRangeMin: 1
m_HAllowExceedBaseRangeMax: 1
m_VAllowExceedBaseRangeMin: 1
m_VAllowExceedBaseRangeMax: 1
m_ScaleWithWindow: 0
m_HSlider: 0
m_VSlider: 0
m_IgnoreScrollWheelUntilClicked: 0
m_EnableMouseInput: 0
m_EnableSliderZoomHorizontal: 0
m_EnableSliderZoomVertical: 0
m_UniformScale: 1
m_UpDirection: 1
m_DrawArea:
serializedVersion: 2
x: 0
y: 21
width: 876
height: 498
m_Scale: {x: 0.45625, y: 0.45625}
m_Translation: {x: 438, y: 249}
m_MarginLeft: 0
m_MarginRight: 0
m_MarginTop: 0
m_MarginBottom: 0
m_LastShownAreaInsideMargins:
serializedVersion: 2
x: -960
y: -545.7534
width: 1920
height: 1091.5068
m_MinimalGUI: 1
m_defaultScale: 0.45625
m_LastWindowPixelSize: {x: 876, y: 519}
m_ClearInEditMode: 1
m_NoCameraWarning: 1
m_LowResolutionForAspectRatios: 01000000000000000000
m_XRRenderMode: 0
m_RenderTexture: {fileID: 0}
--- !u!114 &3
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 1
m_Script: {fileID: 12010, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_Children:
- {fileID: 4}
- {fileID: 6}
m_Position:
serializedVersion: 2
x: 0
y: 0
width: 877
height: 947
m_MinSize: {x: 100, y: 200}
m_MaxSize: {x: 8096, y: 16192}
vertical: 1
controlID: 42029
--- !u!114 &4
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 1
m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0}
m_Name: SceneView
m_EditorClassIdentifier:
m_Children: []
m_Position:
serializedVersion: 2
x: 0
y: 0
width: 877
height: 407
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 5}
m_Panes:
- {fileID: 5}
m_Selected: 0
m_LastSelected: 0
--- !u!114 &5
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 1
m_Script: {fileID: 12013, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_TitleContent:
m_Text: Scene
m_Image: {fileID: 2593428753322112591, guid: 0000000000000000d000000000000000, type: 0}
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 0
y: 73
width: 876
height: 386
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
m_SaveData:
- dockPosition: 0
containerId: overlay-toolbar__top
floating: 0
collapsed: 0
displayed: 1
snapOffset: {x: -171, y: -26}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 3
id: Tool Settings
index: 0
layout: 1
- dockPosition: 0
containerId: overlay-toolbar__top
floating: 0
collapsed: 0
displayed: 1
snapOffset: {x: -141, y: 149}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 1
id: unity-grid-and-snap-toolbar
index: 1
layout: 1
- dockPosition: 1
containerId: overlay-toolbar__top
floating: 0
collapsed: 0
displayed: 1
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: unity-scene-view-toolbar
index: 0
layout: 1
- dockPosition: 1
containerId: overlay-toolbar__top
floating: 0
collapsed: 0
displayed: 0
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 1
id: unity-search-toolbar
index: 1
layout: 1
- dockPosition: 0
containerId: overlay-container--left
floating: 0
collapsed: 0
displayed: 1
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: unity-transform-toolbar
index: 0
layout: 2
- dockPosition: 0
containerId: overlay-container--left
floating: 0
collapsed: 0
displayed: 1
snapOffset: {x: 0, y: 197}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: unity-component-tools
index: 1
layout: 2
- dockPosition: 0
containerId: overlay-container--right
floating: 0
collapsed: 0
displayed: 1
snapOffset: {x: 67.5, y: 26}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: Orientation
index: 0
layout: 4
- dockPosition: 1
containerId: overlay-container--right
floating: 0
collapsed: 0
displayed: 0
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: Scene View/Light Settings
index: 0
layout: 4
- dockPosition: 1
containerId: overlay-container--right
floating: 0
collapsed: 0
displayed: 0
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: Scene View/Camera
index: 1
layout: 4
- dockPosition: 1
containerId: overlay-container--right
floating: 0
collapsed: 0
displayed: 0
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: Scene View/Cloth Constraints
index: 2
layout: 4
- dockPosition: 1
containerId: overlay-container--right
floating: 0
collapsed: 0
displayed: 0
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: Scene View/Cloth Collisions
index: 3
layout: 4
- dockPosition: 1
containerId: overlay-container--right
floating: 0
collapsed: 0
displayed: 0
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: Scene View/Navmesh Display
index: 5
layout: 4
- dockPosition: 1
containerId: overlay-container--right
floating: 0
collapsed: 0
displayed: 0
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: Scene View/Agent Display
index: 7
layout: 4
- dockPosition: 1
containerId: overlay-container--right
floating: 0
collapsed: 0
displayed: 0
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: Scene View/Obstacle Display
index: 9
layout: 4
- dockPosition: 1
containerId: overlay-container--right
floating: 0
collapsed: 0
displayed: 0
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: Scene View/Occlusion Culling
index: 4
layout: 4
- dockPosition: 1
containerId: overlay-container--right
floating: 0
collapsed: 0
displayed: 0
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: Scene View/Physics Debugger
index: 6
layout: 4
- dockPosition: 1
containerId: overlay-container--right
floating: 0
collapsed: 0
displayed: 0
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: Scene View/Scene Visibility
index: 8
layout: 4
- dockPosition: 1
containerId: overlay-container--right
floating: 0
collapsed: 0
displayed: 0
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: Scene View/Particles
index: 10
layout: 4
- dockPosition: 1
containerId: overlay-container--right
floating: 0
collapsed: 0
displayed: 0
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: Scene View/Tilemap
index: 11
layout: 4
- dockPosition: 1
containerId: overlay-container--right
floating: 0
collapsed: 0
displayed: 0
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: Scene View/Tilemap Palette Helper
index: 12
layout: 4
- dockPosition: 1
containerId: overlay-container--right
floating: 0
collapsed: 0
displayed: 0
snapOffset: {x: 48, y: 48}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: Scene View/TrailRenderer
index: 7
layout: 4
- dockPosition: 1
containerId: overlay-container--right
floating: 0
collapsed: 0
displayed: 1
snapOffset: {x: 48, y: 2}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: UnityEditor.SceneViewCameraOverlay
index: 9
layout: 4
- dockPosition: 1
containerId: overlay-container--right
floating: 0
collapsed: 0
displayed: 0
snapOffset: {x: 48, y: 48}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: APV Overlay
index: 8
layout: 4
m_OverlaysVisible: 1
m_WindowGUID: 30731efe385b684419a68e2e2d932ed9
m_Gizmos: 1
m_OverrideSceneCullingMask: 6917529027641081856
m_SceneIsLit: 1
m_SceneLighting: 1
m_2DMode: 0
m_isRotationLocked: 0
m_PlayAudio: 0
m_AudioPlay: 0
m_Position:
m_Target: {x: 0.118888356, y: 0.025530128, z: -0.21660419}
speed: 2
m_Value: {x: 0.118888356, y: 0.025530128, z: -0.21660419}
m_RenderMode: 0
m_CameraMode:
drawMode: 0
name: Shaded
section: Shading Mode
m_ValidateTrueMetals: 0
m_DoValidateTrueMetals: 0
m_ExposureSliderValue: 0
m_SceneViewState:
m_AlwaysRefresh: 0
showFog: 1
showSkybox: 1
showFlares: 1
showImageEffects: 1
showParticleSystems: 1
showVisualEffectGraphs: 1
m_FxEnabled: 0
m_Grid:
xGrid:
m_Fade:
m_Target: 0
speed: 2
m_Value: 0
m_Color: {r: 0.5, g: 0.5, b: 0.5, a: 0.4}
m_Pivot: {x: 0, y: 0, z: 0}
m_Size: {x: 1, y: 1}
yGrid:
m_Fade:
m_Target: 0
speed: 2
m_Value: 0
m_Color: {r: 0.5, g: 0.5, b: 0.5, a: 0.4}
m_Pivot: {x: 0, y: 0, z: 0}
m_Size: {x: 1, y: 1}
zGrid:
m_Fade:
m_Target: 0
speed: 2
m_Value: 0
m_Color: {r: 0.5, g: 0.5, b: 0.5, a: 0.4}
m_Pivot: {x: 0, y: 0, z: 0}
m_Size: {x: 1, y: 1}
m_ShowGrid: 0
m_GridAxis: 1
m_gridOpacity: 0.5
m_Rotation:
m_Target: {x: -0.012225128, y: 0.9736155, z: 0.053793114, w: 0.22160941}
speed: 2
m_Value: {x: -0.012224632, y: 0.97357607, z: 0.053790934, w: 0.22160043}
m_Size:
m_Target: 0.13907154
speed: 2
m_Value: 0.13907154
m_Ortho:
m_Target: 0
speed: 2
m_Value: 0
m_CameraSettings:
m_Speed: 0.01
m_SpeedNormalized: 0
m_SpeedMin: 0.01
m_SpeedMax: 2
m_EasingEnabled: 1
m_EasingDuration: 0.4
m_AccelerationEnabled: 1
m_FieldOfViewHorizontalOrVertical: 60
m_NearClip: 0.03
m_FarClip: 10000
m_DynamicClip: 1
m_OcclusionCulling: 0
m_LastSceneViewRotation: {x: -0.0062419833, y: 0.8918777, z: -0.012318715, w: -0.45214427}
m_LastSceneViewOrtho: 0
m_ReplacementShader: {fileID: 0}
m_ReplacementString:
m_SceneVisActive: 1
m_LastLockedObject: {fileID: 0}
m_ViewIsLockedToObject: 0
--- !u!114 &6
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 1
m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0}
m_Name: GameView
m_EditorClassIdentifier:
m_Children: []
m_Position:
serializedVersion: 2
x: 0
y: 407
width: 877
height: 540
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 2}
m_Panes:
- {fileID: 2}
m_Selected: 0
m_LastSelected: 0
--- !u!114 &7
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 12010, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_Children:
- {fileID: 8}
- {fileID: 10}
m_Position:
serializedVersion: 2
x: 877
y: 0
width: 610
height: 947
m_MinSize: {x: 200, y: 100}
m_MaxSize: {x: 16192, y: 8096}
vertical: 0
controlID: 42051
--- !u!114 &8
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 1
m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_Children: []
m_Position:
serializedVersion: 2
x: 0
y: 0
width: 288
height: 947
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 9}
m_Panes:
- {fileID: 9}
m_Selected: 0
m_LastSelected: 0
--- !u!114 &9
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 1
m_Script: {fileID: 12061, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_TitleContent:
m_Text: Hierarchy
m_Image: {fileID: 7966133145522015247, guid: 0000000000000000d000000000000000, type: 0}
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 877
y: 73
width: 286
height: 926
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
m_SaveData: []
m_OverlaysVisible: 1
m_SceneHierarchy:
m_TreeViewState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 264cfeff
m_LastClickedID: -111578
m_ExpandedIDs: c6bffdffe2bffdfff2bffdff8ac2fdffc6c6fdfff2d8fdfff6d8fdff02d9fdffea53fefff653feffe659feff6288feffbe17ffffc017ffff7018ffff9220ffff6c28ffff9242ffffe842ffff5250ffffa254ffffa654ffff805cffff746affffa676ffffb079ffff727affff1aa7ffffa4b4fffff2b4ffff62b5ffffb0b5ffff1eb6ffff10bcffff26a30000fcb90000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
m_OriginalName:
m_EditFieldRect:
serializedVersion: 2
x: 0
y: 0
width: 0
height: 0
m_UserData: 0
m_IsWaitingForDelay: 0
m_IsRenaming: 0
m_OriginalEventType: 11
m_IsRenamingFilename: 0
m_ClientGUIView: {fileID: 8}
m_SearchString:
m_ExpandedScenes: []
m_CurrenRootInstanceID: 0
m_LockTracker:
m_IsLocked: 0
m_CurrentSortingName: TransformSorting
m_WindowGUID: abe4b46ffaa4cd34ba9c73eb593d2f91
--- !u!114 &10
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0}
m_Name: ProjectBrowser
m_EditorClassIdentifier:
m_Children: []
m_Position:
serializedVersion: 2
x: 288
y: 0
width: 322
height: 947
m_MinSize: {x: 232, y: 271}
m_MaxSize: {x: 10002, y: 10021}
m_ActualView: {fileID: 11}
m_Panes:
- {fileID: 11}
m_Selected: 0
m_LastSelected: 0
--- !u!114 &11
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 1
m_Script: {fileID: 12014, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_MinSize: {x: 230, y: 250}
m_MaxSize: {x: 10000, y: 10000}
m_TitleContent:
m_Text: Project
m_Image: {fileID: -5467254957812901981, guid: 0000000000000000d000000000000000, type: 0}
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 1165
y: 73
width: 320
height: 926
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
m_SaveData: []
m_OverlaysVisible: 1
m_SearchFilter:
m_NameFilter:
m_ClassNames: []
m_AssetLabels: []
m_AssetBundleNames: []
m_ReferencingInstanceIDs:
m_SceneHandles:
m_ShowAllHits: 0
m_SkipHidden: 0
m_SearchArea: 1
m_Folders:
- Assets/GameAssets/Models
m_Globs: []
m_OriginalText:
m_FilterByTypeIntersection: 0
m_ViewMode: 0
m_StartGridSize: 64
m_LastFolders: []
m_LastFoldersGridSize: -1
m_LastProjectPath: "E:\\\u4E1C\u5357\u5927\u5B66\u81EA\u52A8\u63A7\u5236\\ND_SimulationAutomaticControl"
m_LockTracker:
m_IsLocked: 0
m_FolderTreeState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: c0350000
m_LastClickedID: 13760
m_ExpandedIDs: ffffffff000000000e9f00002e9f0000369f0000429f0000449f0000549f00002aa00000aca3000042b80000f4ba0000faba0000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
m_OriginalName:
m_EditFieldRect:
serializedVersion: 2
x: 0
y: 0
width: 0
height: 0
m_UserData: 0
m_IsWaitingForDelay: 0
m_IsRenaming: 0
m_OriginalEventType: 11
m_IsRenamingFilename: 1
m_ClientGUIView: {fileID: 0}
m_SearchString:
m_CreateAssetUtility:
m_EndAction: {fileID: 0}
m_InstanceID: 0
m_Path:
m_Icon: {fileID: 0}
m_ResourceFile:
m_AssetTreeState:
scrollPos: {x: 0, y: 180}
m_SelectedIDs: 264cfeff
m_LastClickedID: 0
m_ExpandedIDs: ffffffff000000000e9f00002e9f0000369f0000429f0000449f0000549f00002aa00000aca3000042b80000f4ba0000faba0000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
m_OriginalName:
m_EditFieldRect:
serializedVersion: 2
x: 0
y: 0
width: 0
height: 0
m_UserData: 0
m_IsWaitingForDelay: 0
m_IsRenaming: 0
m_OriginalEventType: 11
m_IsRenamingFilename: 1
m_ClientGUIView: {fileID: 10}
m_SearchString:
m_CreateAssetUtility:
m_EndAction: {fileID: 0}
m_InstanceID: 0
m_Path:
m_Icon: {fileID: 0}
m_ResourceFile:
m_ListAreaState:
m_SelectedInstanceIDs: 264cfeff
m_LastClickedInstanceID: -111578
m_HadKeyboardFocusLastEvent: 0
m_ExpandedInstanceIDs:
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
m_OriginalName:
m_EditFieldRect:
serializedVersion: 2
x: 0
y: 0
width: 0
height: 0
m_UserData: 0
m_IsWaitingForDelay: 0
m_IsRenaming: 0
m_OriginalEventType: 11
m_IsRenamingFilename: 1
m_ClientGUIView: {fileID: 0}
m_CreateAssetUtility:
m_EndAction: {fileID: 0}
m_InstanceID: 0
m_Path:
m_Icon: {fileID: 0}
m_ResourceFile:
m_NewAssetIndexInList: -1
m_ScrollPosition: {x: 0, y: 0}
m_GridSize: 64
m_SkipHiddenPackages: 0
m_DirectoriesAreaWidth: 115
--- !u!114 &12
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 1
m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0}
m_Name: InspectorWindow
m_EditorClassIdentifier:
m_Children: []
m_Position:
serializedVersion: 2
x: 1487
y: 0
width: 433
height: 947
m_MinSize: {x: 275, y: 50}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 13}
m_Panes:
- {fileID: 13}
- {fileID: 14}
m_Selected: 0
m_LastSelected: 1
--- !u!114 &13
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 1
m_Script: {fileID: 12019, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_MinSize: {x: 275, y: 50}
m_MaxSize: {x: 4000, y: 4000}
m_TitleContent:
m_Text: Inspector
m_Image: {fileID: -2667387946076563598, guid: 0000000000000000d000000000000000, type: 0}
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 1487
y: 73
width: 432
height: 926
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
m_SaveData: []
m_OverlaysVisible: 1
m_ObjectsLockedBeforeSerialization: []
m_InstanceIDsLockedBeforeSerialization:
m_PreviewResizer:
m_CachedPref: 260
m_ControlHash: -371814159
m_PrefName: Preview_InspectorPreview
m_LastInspectedObjectInstanceID: -1
m_LastVerticalScrollValue: 0
m_GlobalObjectId:
m_InspectorMode: 0
m_LockTracker:
m_IsLocked: 0
m_PreviewWindow: {fileID: 0}
--- !u!114 &14
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 12079, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_MinSize: {x: 390, y: 390}
m_MaxSize: {x: 4000, y: 4000}
m_TitleContent:
m_Text: Lighting
m_Image: {fileID: -1347227620855488341, guid: 0000000000000000d000000000000000, type: 0}
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 1487
y: 73
width: 432
height: 926
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
m_SaveData: []
m_OverlaysVisible: 1