Merge branch 'SXElectricityInformationAcquisition' of http://gitea.umayle.com/huangjiayu/ShanxiKnowledgeBase into SXElectricityInformationAcquisition

# Conflicts:
#	SXElectricityInformationAcquisition/Assets/Screwdriver.cs
This commit is contained in:
yzx 2024-06-12 14:54:17 +08:00
commit 9b9874de4c
5 changed files with 130 additions and 81 deletions

View File

@ -10,15 +10,10 @@ public class JunctionBox : MonoBehaviour
/// </summary>
public Transform TransparentlidObj;
///// <summary>
///// 横向滑块
///// </summary>
//public Transform HorizontalSlider;
///// <summary>
///// 纵向滑块
///// </summary>
//public Transform VerticalSlider;
/// <summary>
/// 端子排上所有封印螺丝
/// </summary>
public GameObject[] allObjects;
/// <summary>
/// ÊÇ·ñ¸ÇÉÏ
@ -29,6 +24,7 @@ public class JunctionBox : MonoBehaviour
{
}
void Update()
{
if (Input.GetMouseButtonDown(0))
@ -38,11 +34,11 @@ public class JunctionBox : MonoBehaviour
bool raycast = Physics.Raycast(ray, out hit);
if (raycast)
{
if (hit.collider.gameObject.name == "盖_透明外壳")
{
TransparentlidObj.transform.DOLocalMove(new Vector3(0, -0.0914f, 0),2f);
////判断盖子是否打开
}
//if (hit.collider.gameObject.name == "盖_透明外壳")
//{
// TransparentlidObj.transform.DOLocalMove(new Vector3(0, -0.0914f, 0),2f);
// ////判断盖子是否打开
// }
if (!iscover)
{
//iscover = true;
@ -65,9 +61,27 @@ public class JunctionBox : MonoBehaviour
Debug.Log(hit.collider.gameObject.name);
break;
}
}
}
}
if (AreAllObjectsHidden())
{
TransparentlidObj.transform.DOLocalMove(new Vector3(0, -0.0914f, 0), 2f);
Debug.Log("所有对象都已隐藏");
}
}
public bool AreAllObjectsHidden()
{
// 检查每个对象的激活状态
foreach (GameObject obj in allObjects)
{
if (obj.activeInHierarchy) // 使用 activeInHierarchy 如果你想检查对象是否在其父级结构中被激活
{
return false; // 如果找到任何一个激活的对象返回false
}
}
return true; // 如果所有对象都未激活返回true
}
}

View File

@ -2,7 +2,7 @@ fileFormatVersion: 2
guid: ddf175dcba94e8d46bc6b6d68d61c395
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +1,6 @@
using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using DefaultNamespace.ProcessMode;
using MotionFramework;
using UnityEngine;
/// <summary>
@ -36,13 +34,13 @@ public class Screwdriver : MonoBehaviour
public GameObject RconcentratorScrew;
/// <summary>
/// 集线器螺丝和封印
/// 集线器外壳螺丝和封印
/// </summary>
public GameObject[] concentratorScrew;
/// <summary>
/// 螺丝
/// </summary>a
/// </summary>
public GameObject[] ScrewObj;
/// <summary>
@ -50,6 +48,11 @@ public class Screwdriver : MonoBehaviour
/// </summary>
public SkinnedMeshRenderer ElectricWireSMR;
/// <summary>
/// 电线碰撞
/// </summary>
public BoxCollider ElectricWireBcr;
/// <summary>
/// 集中器盖子
/// </summary>
@ -65,7 +68,12 @@ public class Screwdriver : MonoBehaviour
// Start is called before the first frame update
void Start()
{
//StartCoroutine(IEElectricWire());
Init();
}
void Init()
{
ElectricWireBcr.enabled = false;
}
// Update is called once per frame
@ -103,7 +111,7 @@ public class Screwdriver : MonoBehaviour
if (hit.collider.gameObject.name == ScrewObj[i].name)
{
Debug.Log(hit.collider.gameObject.name);
MotionEngine.GetModule<AnimationProcessManager>().HandleClick(hit.collider.gameObject);
StartCoroutine(IEHubSegmentRowScrews());
ScrewObj[i].gameObject.SetActive(false);
}
//if (!ScrewObj[i].gameObject.activeInHierarchy)
@ -113,20 +121,26 @@ public class Screwdriver : MonoBehaviour
}
}
}
//集中器螺丝全隐藏后播放电线动画
if (AreAllObjectsHidden())
{
StartCoroutine(ScrewdriverBack());
ElectricWireBcr.enabled = true;
StartCoroutine(IEElectricWire());
Debug.Log("所有螺丝都已隐藏");
}
//集中器外壳上的封印和螺丝
if (AllHubOfHubs())
{
HubCoverObj.gameObject.SetActive(false);
HubCoverObj.gameObject.transform.DOLocalMove(new Vector3(0, 0.0167f, -0.2387f),1);
Debug.Log("所有集线器盖子螺丝都已隐藏");
}
}
// 调用这个方法来检查所有游戏对象是否都被隐藏
// 获取所有游戏对象
// public GameObject[] allObjects = FindObjectsOfType<GameObject>();
/// <summary>
/// 集中器螺丝
/// </summary>
/// <returns></returns>
public bool AreAllObjectsHidden()
{
// 检查每个对象的激活状态
@ -141,7 +155,7 @@ public class Screwdriver : MonoBehaviour
}
/// <summary>
/// 集中器盖子螺丝
/// 集中器外壳上的封印和螺丝
/// </summary>
/// <returns></returns>
public bool AllHubOfHubs()
@ -162,8 +176,8 @@ public class Screwdriver : MonoBehaviour
/// <returns></returns>
IEnumerator ScrewdriverBack()
{
ScrewdriverTrans.transform.DOLocalMove(new Vector3(3.274139f, 1.803738f, -1.191f), 1f);
ScrewdriverTrans.transform.DOLocalRotate(new Vector3(-90f, 0, 0), 1f);
ScrewdriverTrans.transform.DOLocalMove(new Vector3(3.274139f, 1.803738f, -1.191f), 0.5f);
ScrewdriverTrans.transform.DOLocalRotate(new Vector3(-90f, 0, 0), 0.5f);
yield return new WaitForSeconds(2f);
}
@ -173,16 +187,16 @@ public class Screwdriver : MonoBehaviour
/// <returns></returns>
IEnumerator Rscrew()
{
ScrewdriverTrans.transform.DOLocalRotate(new Vector3(-19.741f, -113.296f, 90), 1f);
yield return new WaitForSeconds(1.5f);
ScrewdriverTrans.transform.DOLocalRotate(new Vector3(-19.741f, -113.296f, 90), 0.5f);
yield return new WaitForSeconds(0.6f);
ScrewdriverTrans.transform.DOLocalMove(new Vector3(3.2373f, 1.8549f, -1.244f), 1f);
yield return new WaitForSeconds(1);
ScrewdriverTrans.transform.DOLocalRotate(new Vector3(-19.741f, -113.296f, -104.747f), 1f);
yield return new WaitForSeconds(1.5f);
yield return new WaitForSeconds(1.2f);
ScrewdriverTrans.transform.DOLocalMove(new Vector3(3.191f, 1.831f, -1.158f), 1f);
yield return new WaitForSeconds(2f);
ScrewR.transform.DOLocalMove(new Vector3(0.1316f, 0.036f, 0.0034f), 1.5f);
yield return new WaitForSeconds(3f);
yield return new WaitForSeconds(1.5f);
ScrewR.transform.DOLocalMove(new Vector3(0.1316f, 0.036f, 0.0034f), 1.6f);
yield return new WaitForSeconds(1.2f);
StartCoroutine(ScrewdriverBack());
ScrewR.gameObject.SetActive(false);
}
@ -193,19 +207,18 @@ public class Screwdriver : MonoBehaviour
/// <returns></returns>
IEnumerator Lscrew()
{
ScrewdriverTrans.transform.DOLocalMove(new Vector3(3.2373f, 1.8284f, -1.3885f), 1f);
yield return new WaitForSeconds(1.5f);
ScrewdriverTrans.transform.DOLocalMove(new Vector3(3.2373f, 1.8284f, -1.3885f), 0.5f);
yield return new WaitForSeconds(0.6f);
ScrewdriverTrans.transform.DOLocalRotate(new Vector3(-19.741f, -113.296f, -104.747f), 1f);
yield return new WaitForSeconds(1.5f);
yield return new WaitForSeconds(1f);
ScrewdriverTrans.transform.DOLocalRotate(new Vector3(-19.741f, -113.296f, 90), 1f);
yield return new WaitForSeconds(1.5f);
ScrewL.transform.DOLocalMove(new Vector3(-0.07357633f, -0.01137948f, -0.0366f), 1f);
yield return new WaitForSeconds(2f);
yield return new WaitForSeconds(1.2f);
StartCoroutine(ScrewdriverBack());
ScrewL.gameObject.SetActive(false);
}
/// <summary>
/// 集中器右侧螺丝
/// </summary>
@ -254,35 +267,36 @@ public class Screwdriver : MonoBehaviour
yield return new WaitForSeconds(0.001f);
ElectricWireSMR.SetBlendShapeWeight(0, i);
}
//yield return new WaitForSeconds(1f);
for (int i = 0; i <= 100; i++)
{
yield return new WaitForSeconds(0.002f);
ElectricWireSMR.SetBlendShapeWeight(1, i);
}
//yield return new WaitForSeconds(1f);
for (int i = 0; i <= 100; i++)
{
yield return new WaitForSeconds(0.002f);
ElectricWireSMR.SetBlendShapeWeight(2, i);
}
//yield return new WaitForSeconds(1f);
for (int i = 0; i <= 100; i++)
{
yield return new WaitForSeconds(0.002f);
ElectricWireSMR.SetBlendShapeWeight(3, i);
}
//yield return new WaitForSeconds(1f);
for (int i = 0; i <= 100; i++)
{
yield return new WaitForSeconds(0.002f);
ElectricWireSMR.SetBlendShapeWeight(4, i);
}
//yield return new WaitForSeconds(1f);
for (int i = 0; i <= 100; i++)
{
yield return new WaitForSeconds(0.002f);
ElectricWireSMR.SetBlendShapeWeight(5, i);
}
}
IEnumerator IEHubSegmentRowScrews()
{
ScrewdriverTrans.gameObject.transform.DOLocalMove(new Vector3(3.1215f, 2.1383f, -1.3484f),0.5f);
yield return new WaitForSeconds(1);
}
}

View File

@ -42,13 +42,17 @@ using UnityEngine;
{
if (hit.collider.gameObject.name == "pCylinder170")
{
StartCoroutine(tape());
StartCoroutine(Tape());
}
}
}
}
IEnumerator tape()
/// <summary>
/// 电线缠
/// </summary>
/// <returns></returns>
IEnumerator Tape()
{
TapeOBJ.gameObject.transform.DOLocalMove(new Vector3(3.1215f, 2.1383f, -1.3484f),1f);
yield return new WaitForSeconds(1f);
@ -63,5 +67,19 @@ using UnityEngine;
TapeMar.SetFloat("_step_p5", 1);
yield return new WaitForSeconds(1f);
TapeMar.SetFloat("_step_p6", 1);
yield return new WaitForSeconds(1f);
StartCoroutine(TapeBack());
}
/// <summary>
/// 胶带返回动画
/// </summary>
/// <returns></returns>
IEnumerator TapeBack()
{
TapeOBJ.transform.DOLocalMove(new Vector3(3.179443f, 1.790938f, -1.107346f),1f);
yield return null;
}
}

View File

@ -14,7 +14,7 @@ public class Pliers : MonoBehaviour
public GameObject PliersObj;
/// <summary>
/// ǯÏß¶¯»­
/// 剥线钳动画
/// </summary>
public SkinnedMeshRenderer PliersSki;
@ -60,6 +60,12 @@ public class Pliers : MonoBehaviour
void Start()
{
Init();
}
void Init()
{
PliersSki.SetBlendShapeWeight(0, 0);
//PliersAni.Play("Ïßǯ");
}
@ -118,15 +124,15 @@ public class Pliers : MonoBehaviour
//yield return new WaitForSeconds(2f);
for (int i = 100; i >= 0; i--)
{
yield return new WaitForSeconds(0.01f);
yield return new WaitForSeconds(0.001f);
PliersSki.SetBlendShapeWeight(0, i);
}
yield return new WaitForSeconds(1f);
yield return new WaitForSeconds(0.1f);
StartCoroutine(OpenLock());
}
/// <summary>
/// ´ò¿ª·âÓ¡¶¯»­
/// 打开柜门封印动画
/// </summary>
/// <returns></returns>
IEnumerator OpenLock()
@ -136,10 +142,10 @@ public class Pliers : MonoBehaviour
yield return new WaitForSeconds(0.001f);
ElectricBoxSkinnedMeshRenderer.SetBlendShapeWeight(0, i);
}
yield return new WaitForSeconds(0.1f);
ElectricBoxSkinnedMeshRenderer.gameObject.transform.DOLocalMove(new Vector3(0.637f, 0.12f, -0.015f), 0.5f);
yield return new WaitForSeconds(1f);
ElectricBoxSkinnedMeshRenderer.gameObject.transform.DOLocalMove(new Vector3(0.637f, 0.12f, -0.015f), 1f);
yield return new WaitForSeconds(2f);
Destroy(ElectricBoxSkinnedMeshRenderer);
ElectricBoxSkinnedMeshRenderer.gameObject.SetActive(false);
StartCoroutine(OpenDoor());
}
@ -149,7 +155,7 @@ public class Pliers : MonoBehaviour
/// <returns></returns>
IEnumerator OpenDoor()
{
yield return new WaitForSeconds(0.5f);
//yield return new WaitForSeconds(0.5f);
Doorlock.transform.DOLocalRotate(new Vector3(160, 0, 0), 1f);
yield return new WaitForSeconds(1.5f);
DoorOfCabinet.transform.DOLocalRotate(new Vector3(-90, 0, 160), 2f);
@ -162,9 +168,9 @@ public class Pliers : MonoBehaviour
/// <returns></returns>
IEnumerator PliersBack()
{
PliersObj.gameObject.transform.DOMove(new Vector3(303.05f, 2.386f, 163.028f),1.5f);
PliersObj.gameObject.transform.DORotate(new Vector3(0,90,0),1.5f);
yield return new WaitForSeconds(2f);
PliersObj.gameObject.transform.DOMove(new Vector3(303.05f, 2.386f, 163.028f),1f);
PliersObj.gameObject.transform.DORotate(new Vector3(0,90,0),1f);
yield return new WaitForSeconds(1.5f);
//PliersObj.gameObject.SetActive(false);
}
@ -174,18 +180,16 @@ public class Pliers : MonoBehaviour
/// <returns></returns>
IEnumerator JunctionBoxRight()
{
PliersObj.gameObject.transform.DOLocalRotate(new Vector3(-90, 90, 0), 0.5f);
yield return new WaitForSeconds(1f);
PliersObj.gameObject.transform.DOLocalMove(new Vector3(3.1497f, 1.888f, -1.3079f), 0.5f);
yield return new WaitForSeconds(2f);
yield return new WaitForSeconds(1f);
for (int i = 100; i >= 0; i--)
{
yield return new WaitForSeconds(0.001f);
PliersSki.SetBlendShapeWeight(0, i);
}
yield return new WaitForSeconds(2f);
yield return new WaitForSeconds(0.5f);
for (int i = 0; i < 100; i++)
{
yield return new WaitForSeconds(0.001f);
@ -206,10 +210,9 @@ public class Pliers : MonoBehaviour
{
//PliersObj.gameObject.SetActive(true);
PliersObj.gameObject.transform.DOLocalRotate(new Vector3(-90, 90, 0), 0.5f);
yield return new WaitForSeconds(1f);
yield return new WaitForSeconds(0.8f);
PliersObj.gameObject.transform.DOLocalMove(new Vector3(3.1672f, 1.8637f, -1.4392f), 1f);
yield return new WaitForSeconds(2f);
yield return new WaitForSeconds(1.5f);
for (int i = 100; i >= 0; i--)
{
yield return new WaitForSeconds(0.001f);
@ -221,8 +224,8 @@ public class Pliers : MonoBehaviour
yield return new WaitForSeconds(0.001f);
LeftSkinnedMeshRenderer.SetBlendShapeWeight(0, i);
}
LeftSkinnedMeshRenderer.gameObject.transform.DOLocalMove(new Vector3(-0.0744f, -0.0247f, -0.043f), 1f);
yield return new WaitForSeconds(1.5f);
LeftSkinnedMeshRenderer.gameObject.transform.DOLocalMove(new Vector3(-0.0744f, -0.0247f, -0.043f), 0.5f);
yield return new WaitForSeconds(1f);
StartCoroutine(PliersBack());
LeftSkinnedMeshRenderer.gameObject.SetActive(false);
//Destroy(LeftSkinnedMeshRenderer);
@ -234,23 +237,23 @@ public class Pliers : MonoBehaviour
/// <returns></returns>
IEnumerator RightRconcentrator()
{
PliersObj.gameObject.transform.DOLocalRotate(new Vector3(-90, 90, 0), 1.5f);
yield return new WaitForSeconds(1.5f);
PliersObj.gameObject.transform.DOLocalRotate(new Vector3(-90, 90, 0), 0.5f);
yield return new WaitForSeconds(1.2f);
PliersObj.gameObject.transform.DOLocalMove(new Vector3(3.1687f, 2.1218f, -1.4082f), 1f);
yield return new WaitForSeconds(2f);
yield return new WaitForSeconds(1f);
for (int i = 100; i >= 0; i--)
{
yield return new WaitForSeconds(0.001f);
PliersSki.SetBlendShapeWeight(0, i);
}
yield return new WaitForSeconds(3f);
yield return new WaitForSeconds(1f);
for (int i = 0; i < 100; i++)
{
yield return new WaitForSeconds(0.001f);
RconcentratorSMR.SetBlendShapeWeight(0, i);
}
RconcentratorSMR.gameObject.transform.DOLocalMove(new Vector3(-0.066f, 0.0611f, -0.1134f), 1f);
yield return new WaitForSeconds(1.5f);
RconcentratorSMR.gameObject.transform.DOLocalMove(new Vector3(-0.066f, 0.0611f, -0.1134f), 0.5f);
yield return new WaitForSeconds(1f);
StartCoroutine(PliersBack());
RconcentratorSMR.gameObject.SetActive(false);
}
@ -261,23 +264,23 @@ public class Pliers : MonoBehaviour
/// <returns></returns>
IEnumerator LeftRconcentrator()
{
PliersObj.gameObject.transform.DOLocalRotate(new Vector3(-90, 90, 0), 1.5f);
yield return new WaitForSeconds(1.5f);
PliersObj.gameObject.transform.DOLocalRotate(new Vector3(-90, 90, 0), 0.5f);
yield return new WaitForSeconds(1.2f);
PliersObj.gameObject.transform.DOLocalMove(new Vector3(3.1683f, 2.1293f, -1.5439f), 1f);
yield return new WaitForSeconds(2f);
yield return new WaitForSeconds(1f);
for (int i = 100; i >= 0; i--)
{
yield return new WaitForSeconds(0.01f);
yield return new WaitForSeconds(0.001f);
PliersSki.SetBlendShapeWeight(0, i);
}
yield return new WaitForSeconds(3f);
yield return new WaitForSeconds(1f);
for (int i = 0; i < 100; i++)
{
yield return new WaitForSeconds(0.01f);
yield return new WaitForSeconds(0.001f);
LconcentratorSMR.SetBlendShapeWeight(0, i);
}
LconcentratorSMR.gameObject.transform.DOLocalMove(new Vector3(-0.0659f, 0.0829f, -0.1134f), 1f);
yield return new WaitForSeconds(1.5f);
LconcentratorSMR.gameObject.transform.DOLocalMove(new Vector3(-0.0659f, 0.0829f, -0.1134f), 0.5f);
yield return new WaitForSeconds(1f);
StartCoroutine(PliersBack());
LconcentratorSMR.gameObject.SetActive(false);
}