1、更新修改模型(父物体带网格)
2、添加房间检测器 3、弹窗添加关闭 4、修改设备类弹窗默认设备类型下拉菜单 5、修改初始设备生成位置
This commit is contained in:
parent
37bcba9130
commit
981bea17ce
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -29,7 +29,8 @@ public class DeviceItem : MonoBehaviour
|
|||
{
|
||||
|
||||
BoxCollider boxCollider = GetComponent<BoxCollider>();
|
||||
if (!boxCollider)
|
||||
Collider collider = GetComponent<Collider>();
|
||||
if (!boxCollider && !collider)
|
||||
{
|
||||
if (gameObject.GetComponent<MeshRenderer>() != null)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,225 @@
|
|||
using System.Collections.Generic;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class tmptool : MonoBehaviour
|
||||
{
|
||||
public Transform a;
|
||||
public Transform b;
|
||||
public List<MeshRenderer> arender = new List<MeshRenderer>();
|
||||
public List<MeshRenderer> brender = new List<MeshRenderer>();
|
||||
public List<Material> amats = new List<Material>();
|
||||
public List<Material> bmats = new List<Material>();
|
||||
|
||||
[ContextMenu("GetRenderer")]
|
||||
public void GetMat()
|
||||
{
|
||||
arender.Clear();
|
||||
brender.Clear();
|
||||
|
||||
var xa = a.GetComponentsInChildren<MeshRenderer>();
|
||||
for (int i = 0; i < xa.Length; i++)
|
||||
{
|
||||
if (xa[i].name.Contains("R"))
|
||||
{
|
||||
arender.Add(xa[i]);
|
||||
}
|
||||
}
|
||||
var xb = b.GetComponentsInChildren<MeshRenderer>();
|
||||
for (int i = 0; i < xb.Length; i++)
|
||||
{
|
||||
if (xb[i].name.Contains("R"))
|
||||
{
|
||||
brender.Add(xb[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[ContextMenu("Compair")]
|
||||
public void Compair()
|
||||
{
|
||||
//for (int i = 0; i < arender.Count; i++)
|
||||
//{
|
||||
// if (brender[i].GetComponent<MeshFilter>().mesh.name == arender[i].GetComponent<MeshFilter>().mesh.name)
|
||||
// {
|
||||
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Debug.Log("名称不匹配");
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
[ContextMenu("Replace Materials")]
|
||||
public void Replace()
|
||||
{
|
||||
for (int i = 0; i < arender.Count; i++)
|
||||
{
|
||||
//brender[i].materials = new Material[arender[i].materials.Length];
|
||||
//for (int j = 0; j < brender[i].materials.Length; j++)
|
||||
//{
|
||||
// brender[i].CopyComponent
|
||||
//}
|
||||
UnityEditorInternal.ComponentUtility.CopyComponent(arender[i]);
|
||||
UnityEditorInternal.ComponentUtility.PasteComponentValues(brender[i]);
|
||||
}
|
||||
}
|
||||
|
||||
#region Mesh Filter
|
||||
|
||||
public List<MeshFilter> ameshFilter = new List<MeshFilter>();
|
||||
|
||||
[ContextMenu("获取AMeshFilter组件")]
|
||||
/// <summary>
|
||||
/// 获取Mesh组件
|
||||
/// </summary>
|
||||
void GetAMeshFilter()
|
||||
{
|
||||
for (int i = 0; i < a.childCount; i++)
|
||||
{
|
||||
//if (a.GetChild(i).GetComponent<Mesh>())
|
||||
//{
|
||||
// ameshs.Add(a.GetChild(i).GetComponent<Mesh>());
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// ameshs.Add(a.GetChild(i).getc<Mesh>());
|
||||
//}
|
||||
//ameshs.Add(a.GetChild(i).GetComponentInChildren<MeshFilter>());
|
||||
if (a.GetChild(i).GetComponent<MeshFilter>())
|
||||
ameshFilter.Add(a.GetChild(i).GetComponent<MeshFilter>());
|
||||
}
|
||||
if (a.childCount == 0)
|
||||
ameshFilter.Add(a.GetComponent<MeshFilter>());
|
||||
}
|
||||
|
||||
public List<MeshFilter> bmeshsFilter = new List<MeshFilter>();
|
||||
|
||||
[ContextMenu("获取BMeshFilter组件")]
|
||||
/// <summary>
|
||||
/// 获取Mesh组件
|
||||
/// </summary>
|
||||
void GetBMeshFilter()
|
||||
{
|
||||
for (int i = 0; i < b.childCount; i++)
|
||||
{
|
||||
//if (a.GetChild(i).GetComponent<Mesh>())
|
||||
//{
|
||||
// ameshs.Add(a.GetChild(i).GetComponent<Mesh>());
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// ameshs.Add(a.GetChild(i).getc<Mesh>());
|
||||
//}
|
||||
//bmeshs.Add(b.GetChild(i).GetComponentInChildren<MeshFilter>());
|
||||
if (b.GetChild(i).GetComponent<MeshFilter>())
|
||||
bmeshsFilter.Add(b.GetChild(i).GetComponent<MeshFilter>());
|
||||
}
|
||||
if (b.GetChild(0).name == "锚点")
|
||||
bmeshsFilter.Add(b.GetComponent<MeshFilter>());
|
||||
}
|
||||
|
||||
[ContextMenu("Replace BMeshFilter")]
|
||||
public void ReplaceABMesh()
|
||||
{
|
||||
for (int i = 0; i < ameshFilter.Count; i++)
|
||||
{
|
||||
//brender[i].materials = new Material[arender[i].materials.Length];
|
||||
//for (int j = 0; j < brender[i].materials.Length; j++)
|
||||
//{
|
||||
// brender[i].CopyComponent
|
||||
//}
|
||||
UnityEditorInternal.ComponentUtility.CopyComponent(ameshFilter[i]);
|
||||
UnityEditorInternal.ComponentUtility.PasteComponentValues(bmeshsFilter[i]);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
[ContextMenu("-----------------------------------------------------------------")]
|
||||
public void asd() { }
|
||||
#region Mesh
|
||||
|
||||
public List<MeshRenderer> a_meshs = new List<MeshRenderer>();
|
||||
|
||||
[ContextMenu("获取AMesh组件")]
|
||||
/// <summary>
|
||||
/// 获取Mesh组件
|
||||
/// </summary>
|
||||
void GetAMesh()
|
||||
{
|
||||
for (int i = 0; i < a.childCount; i++)
|
||||
{
|
||||
|
||||
//a_meshs.Add(a.GetChild(i).GetComponentInChildren<MeshRenderer>());
|
||||
|
||||
if (a.GetChild(i).GetComponent<MeshRenderer>())
|
||||
a_meshs.Add(a.GetChild(i).GetComponent<MeshRenderer>());
|
||||
}
|
||||
if (a.childCount == 0)
|
||||
a_meshs.Add(a.GetComponent<MeshRenderer>());
|
||||
}
|
||||
|
||||
public List<MeshRenderer> b_meshs = new List<MeshRenderer>();
|
||||
|
||||
[ContextMenu("获取BMesh组件")]
|
||||
/// <summary>
|
||||
/// 获取Mesh组件
|
||||
/// </summary>
|
||||
void GetBMesh()
|
||||
{
|
||||
for (int i = 0; i < b.childCount; i++)
|
||||
{
|
||||
|
||||
//b_meshs.Add(b.GetChild(i).GetComponentInChildren<MeshRenderer>());
|
||||
if (b.GetChild(i).GetComponent<MeshRenderer>())
|
||||
b_meshs.Add(b.GetChild(i).GetComponent<MeshRenderer>());
|
||||
}
|
||||
if (b.GetChild(0).name == "锚点")
|
||||
b_meshs.Add(b.GetComponent<MeshRenderer>());
|
||||
}
|
||||
|
||||
[ContextMenu("Replace BMesh")]
|
||||
public void ReplaceA_BMesh()
|
||||
{
|
||||
for (int i = 0; i < a_meshs.Count; i++)
|
||||
{
|
||||
|
||||
UnityEditorInternal.ComponentUtility.CopyComponent(a_meshs[i]);
|
||||
UnityEditorInternal.ComponentUtility.PasteComponentValues(b_meshs[i]);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public void change_mat()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
[ContextMenu("粘贴5个脚本")]
|
||||
public void Replace5()
|
||||
{
|
||||
var b1 = b.AddComponent<DeviceQuery>();
|
||||
var b2 = b.AddComponent<DragTest>();
|
||||
var b3 = b.AddComponent<TmsAlarmQuery>();
|
||||
var b4 = b.AddComponent<TransparentGlow>();
|
||||
var b5 = b.AddComponent<DragTest1>();
|
||||
|
||||
UnityEditorInternal.ComponentUtility.CopyComponent(a.GetComponent<DeviceQuery>());
|
||||
UnityEditorInternal.ComponentUtility.PasteComponentValues(b1);
|
||||
|
||||
UnityEditorInternal.ComponentUtility.CopyComponent(a.GetComponent<DragTest>());
|
||||
UnityEditorInternal.ComponentUtility.PasteComponentValues(b2);
|
||||
|
||||
UnityEditorInternal.ComponentUtility.CopyComponent(a.GetComponent<TmsAlarmQuery>());
|
||||
UnityEditorInternal.ComponentUtility.PasteComponentValues(b3);
|
||||
|
||||
UnityEditorInternal.ComponentUtility.CopyComponent(a.GetComponent<TransparentGlow>());
|
||||
UnityEditorInternal.ComponentUtility.PasteComponentValues(b4);
|
||||
|
||||
UnityEditorInternal.ComponentUtility.CopyComponent(a.GetComponent<DragTest1>());
|
||||
UnityEditorInternal.ComponentUtility.PasteComponentValues(b5);
|
||||
|
||||
if (!b.GetComponent<MeshCollider>()) b.AddComponent<MeshCollider>();
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4639552b26e261a4daabaacfa136cc4a
|
||||
guid: e385d4efe291c4c499e39f6c890a6b1b
|
||||
ModelImporter:
|
||||
serializedVersion: 21202
|
||||
internalIDToNameTable: []
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 24421931225f7c94ba34dad69975bdc7
|
||||
guid: 92b842c03dca1624e8e66a76a8fea3ef
|
||||
ModelImporter:
|
||||
serializedVersion: 21202
|
||||
internalIDToNameTable: []
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dbcec49902104724a91bf89bfb2f49a0
|
||||
guid: b61be62735b2c964fa242c3ffa7e2af7
|
||||
ModelImporter:
|
||||
serializedVersion: 21202
|
||||
internalIDToNameTable: []
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d441093548d6b064287ca795d1895756
|
||||
guid: 28c87801a9b55a346a619e0b82730f6f
|
||||
ModelImporter:
|
||||
serializedVersion: 21202
|
||||
internalIDToNameTable: []
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9c42ac6ac0535f240ab0c0acd0db6846
|
||||
guid: 88d44f5b2ebee0a4dbff0e650d202634
|
||||
ModelImporter:
|
||||
serializedVersion: 21202
|
||||
internalIDToNameTable: []
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 26b99762eb306994ba689a079ddecafe
|
||||
guid: f3d13bb371d9ee04dae157e80c18f24b
|
||||
ModelImporter:
|
||||
serializedVersion: 21202
|
||||
internalIDToNameTable: []
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bf2135073dc323b4997612f887a52318
|
||||
guid: 02ee53bb9fd9bdf4d875f570480cc9cd
|
||||
ModelImporter:
|
||||
serializedVersion: 21202
|
||||
internalIDToNameTable: []
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b20b9863a0188c74a836089de253951a
|
||||
guid: 38d78f271938d6c4686b952b3257872c
|
||||
ModelImporter:
|
||||
serializedVersion: 21202
|
||||
internalIDToNameTable: []
|
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue