From 64f95e753348bf273ac2cc51f51947e78019d8b4 Mon Sep 17 00:00:00 2001 From: taosuqi <2274240467@qq.com> Date: Wed, 12 Jun 2024 13:42:54 +0800 Subject: [PATCH] =?UTF-8?q?6.12=E4=B8=8A=E5=8D=88=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/JunctionBox.cs | 44 ++++++++---- .../Model/电线杆/Mat/绝缘胶带绑线p1.mat.meta | 2 +- .../Assets/Screwdriver.cs | 69 +++++++++++------- .../Assets/taoruiqi/AdhesiveTape.cs | 22 +++++- .../Assets/taoruiqi/Pliers.cs | 71 ++++++++++--------- 5 files changed, 130 insertions(+), 78 deletions(-) diff --git a/SXElectricityInformationAcquisition/Assets/JunctionBox.cs b/SXElectricityInformationAcquisition/Assets/JunctionBox.cs index 55431c12..1a77cc2f 100644 --- a/SXElectricityInformationAcquisition/Assets/JunctionBox.cs +++ b/SXElectricityInformationAcquisition/Assets/JunctionBox.cs @@ -10,15 +10,10 @@ public class JunctionBox : MonoBehaviour /// public Transform TransparentlidObj; - ///// - ///// 򻬿 - ///// - //public Transform HorizontalSlider; - - ///// - ///// 򻬿 - ///// - //public Transform VerticalSlider; + /// + /// зӡ˿ + /// + public GameObject[] allObjects; /// /// Ƿ @@ -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 } } diff --git a/SXElectricityInformationAcquisition/Assets/Model/电线杆/Mat/绝缘胶带绑线p1.mat.meta b/SXElectricityInformationAcquisition/Assets/Model/电线杆/Mat/绝缘胶带绑线p1.mat.meta index 818cc842..945080a9 100644 --- a/SXElectricityInformationAcquisition/Assets/Model/电线杆/Mat/绝缘胶带绑线p1.mat.meta +++ b/SXElectricityInformationAcquisition/Assets/Model/电线杆/Mat/绝缘胶带绑线p1.mat.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: ddf175dcba94e8d46bc6b6d68d61c395 NativeFormatImporter: externalObjects: {} - mainObjectFileID: 2100000 + mainObjectFileID: 0 userData: assetBundleName: assetBundleVariant: diff --git a/SXElectricityInformationAcquisition/Assets/Screwdriver.cs b/SXElectricityInformationAcquisition/Assets/Screwdriver.cs index 8b65442f..36940da7 100644 --- a/SXElectricityInformationAcquisition/Assets/Screwdriver.cs +++ b/SXElectricityInformationAcquisition/Assets/Screwdriver.cs @@ -34,13 +34,13 @@ public class Screwdriver : MonoBehaviour public GameObject RconcentratorScrew; /// - /// ˿ͷӡ + /// ˿ͷӡ /// public GameObject[] concentratorScrew; /// /// ˿ - /// a + /// public GameObject[] ScrewObj; /// @@ -48,6 +48,11 @@ public class Screwdriver : MonoBehaviour /// public SkinnedMeshRenderer ElectricWireSMR; + /// + /// ײ + /// + public BoxCollider ElectricWireBcr; + /// /// /// @@ -63,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 @@ -101,6 +111,7 @@ public class Screwdriver : MonoBehaviour if (hit.collider.gameObject.name == ScrewObj[i].name) { Debug.Log(hit.collider.gameObject.name); + StartCoroutine(IEHubSegmentRowScrews()); ScrewObj[i].gameObject.SetActive(false); } //if (!ScrewObj[i].gameObject.activeInHierarchy) @@ -110,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(); + + /// + /// ˿ + /// + /// public bool AreAllObjectsHidden() { // ÿļ״̬ @@ -138,7 +155,7 @@ public class Screwdriver : MonoBehaviour } /// - /// ˿ + /// ϵķӡ˿ /// /// public bool AllHubOfHubs() @@ -159,8 +176,8 @@ public class Screwdriver : MonoBehaviour /// 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); } @@ -170,16 +187,16 @@ public class Screwdriver : MonoBehaviour /// 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); } @@ -190,19 +207,18 @@ public class Screwdriver : MonoBehaviour /// 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); } - /// /// Ҳ˿ /// @@ -251,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); + } } diff --git a/SXElectricityInformationAcquisition/Assets/taoruiqi/AdhesiveTape.cs b/SXElectricityInformationAcquisition/Assets/taoruiqi/AdhesiveTape.cs index 65861c5d..a10f27b8 100644 --- a/SXElectricityInformationAcquisition/Assets/taoruiqi/AdhesiveTape.cs +++ b/SXElectricityInformationAcquisition/Assets/taoruiqi/AdhesiveTape.cs @@ -42,13 +42,17 @@ using UnityEngine; { if (hit.collider.gameObject.name == "pCylinder170") { - StartCoroutine(tape()); + StartCoroutine(Tape()); } } } } - IEnumerator tape() + /// + /// ߲ + /// + /// + 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()); } + + /// + /// ض + /// + /// + IEnumerator TapeBack() + { + TapeOBJ.transform.DOLocalMove(new Vector3(3.179443f, 1.790938f, -1.107346f),1f); + yield return null; + } + + } diff --git a/SXElectricityInformationAcquisition/Assets/taoruiqi/Pliers.cs b/SXElectricityInformationAcquisition/Assets/taoruiqi/Pliers.cs index f02b0451..4490b45f 100644 --- a/SXElectricityInformationAcquisition/Assets/taoruiqi/Pliers.cs +++ b/SXElectricityInformationAcquisition/Assets/taoruiqi/Pliers.cs @@ -14,7 +14,7 @@ public class Pliers : MonoBehaviour public GameObject PliersObj; /// - /// ǯ߶ + /// ǯ /// 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()); } /// - /// 򿪷ӡ + /// 򿪹ŷӡ /// /// 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 /// 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 /// 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 /// 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 /// 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 /// 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); }