From 878d6cd25be36f6db9499f4dfb896ca243af3246 Mon Sep 17 00:00:00 2001 From: "2274240467@qq.com" <2274240467@qq.com> Date: Fri, 21 Jun 2024 18:57:23 +0800 Subject: [PATCH] =?UTF-8?q?6.21=E6=99=9A=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Model/电线杆/Mat/绝缘胶带绑线p1.mat | 12 +- .../Assets/Scenes/现场 _Test.unity | 67 ++++---- .../Assets/ToolManager.cs | 159 ++++++++++++++---- .../Assets/ToolsManager.cs | 45 ----- .../Assets/ToolsManager.cs.meta | 11 -- .../Assets/taoruiqi/LadderTrigger.cs | 21 ++- .../taoruiqi/Script/Field observation.cs | 53 ++++-- .../Assets/taoruiqi/Script/ToolsManager.cs | 48 +++++- 8 files changed, 270 insertions(+), 146 deletions(-) delete mode 100644 SXElectricityInformationAcquisition/Assets/ToolsManager.cs delete mode 100644 SXElectricityInformationAcquisition/Assets/ToolsManager.cs.meta diff --git a/SXElectricityInformationAcquisition/Assets/Model/电线杆/Mat/绝缘胶带绑线p1.mat b/SXElectricityInformationAcquisition/Assets/Model/电线杆/Mat/绝缘胶带绑线p1.mat index 2fa1692f..50c8efb9 100644 --- a/SXElectricityInformationAcquisition/Assets/Model/电线杆/Mat/绝缘胶带绑线p1.mat +++ b/SXElectricityInformationAcquisition/Assets/Model/电线杆/Mat/绝缘胶带绑线p1.mat @@ -114,12 +114,12 @@ Material: - _UVSec: 0 - _ZWrite: 1 - __dirty: 0 - - _step_p1: 1 - - _step_p2: 1 - - _step_p3: 1 - - _step_p4: 1 - - _step_p5: 1 - - _step_p6: 1 + - _step_p1: 0 + - _step_p2: 0 + - _step_p3: 0 + - _step_p4: 0 + - _step_p5: 0 + - _step_p6: 0 m_Colors: - _BaseCol: {r: 0.23429155, g: 0.28497556, b: 0.3679245, a: 0} - _Color: {r: 1, g: 1, b: 1, a: 1} diff --git a/SXElectricityInformationAcquisition/Assets/Scenes/现场 _Test.unity b/SXElectricityInformationAcquisition/Assets/Scenes/现场 _Test.unity index 95f2b1f3..4214aa55 100644 --- a/SXElectricityInformationAcquisition/Assets/Scenes/现场 _Test.unity +++ b/SXElectricityInformationAcquisition/Assets/Scenes/现场 _Test.unity @@ -25827,7 +25827,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 7587649942819475418, guid: 87ec8db29445cbe4b81cdbb1df57859f, type: 3} propertyPath: m_IsActive - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 8555740474756033510, guid: 87ec8db29445cbe4b81cdbb1df57859f, type: 3} propertyPath: m_Enabled @@ -26759,7 +26759,6 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1505150131} - - component: {fileID: 1505150132} - component: {fileID: 1505150133} m_Layer: 0 m_Name: Mangner @@ -26783,31 +26782,6 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &1505150132 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1505150129} - m_Enabled: 0 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: e33923dee0d2a0f4f81ca859f6fc70d5, type: 3} - m_Name: - m_EditorClassIdentifier: - Tool: - - {fileID: 1422411946} - - {fileID: 895989071} - - {fileID: 0} - - {fileID: 0} - - {fileID: 1112936940} - - {fileID: 588400109} - - {fileID: 1485260145} - - {fileID: 2018635915} - ui: {fileID: 1393670468} - processBt: {fileID: 1290596210} - PutBack: {fileID: 506401300} - RetractToolBtn: [] --- !u!114 &1505150133 MonoBehaviour: m_ObjectHideFlags: 0 @@ -26845,7 +26819,14 @@ MonoBehaviour: returnButton: {fileID: 587729411} originalPosition: {x: 0, y: 0, z: 0} originalRotation: {x: 0, y: 0, z: 0, w: 0} + onladderTools: + - {fileID: 4441233656616589336} + - {fileID: 1112936940} + - {fileID: 588400109} + - {fileID: 1485260145} + - {fileID: 2018635915} PlayercameraTrans: {fileID: 6121626523118833240} + Fieldobservation: {fileID: 6121626523908351180} --- !u!1 &1511629609 GameObject: m_ObjectHideFlags: 0 @@ -33307,6 +33288,7 @@ MonoBehaviour: - {fileID: 1869768458} - {fileID: 156402808} - {fileID: 587729411} + inthis: 0 --- !u!114 &1810323354 MonoBehaviour: m_ObjectHideFlags: 0 @@ -33339,8 +33321,8 @@ BoxCollider: m_ProvidesContacts: 0 m_Enabled: 1 serializedVersion: 3 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} + m_Size: {x: 1, y: 0.27271962, z: 1} + m_Center: {x: 0, y: -0.3636381, z: 0} --- !u!23 &1810323356 MeshRenderer: m_ObjectHideFlags: 0 @@ -35920,6 +35902,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1987581050} + - component: {fileID: 1987581051} m_Layer: 0 m_Name: UptheladderPos m_TagString: Untagged @@ -35942,6 +35925,27 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0} +--- !u!65 &1987581051 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1987581049} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 1 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 0.64779663, y: 0.311777, z: 0.7752075} + m_Center: {x: 0.08128357, y: -0.17483073, z: 0.044403076} --- !u!1 &1994043557 GameObject: m_ObjectHideFlags: 0 @@ -229959,6 +229963,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 3250306475833635928, guid: 8b993b62b75a2c8438fceaa4a463c01a, type: 3} + propertyPath: m_BlendShapeWeights.Array.data[0] + value: 0 + objectReference: {fileID: 0} - target: {fileID: 4466956671881593809, guid: 8b993b62b75a2c8438fceaa4a463c01a, type: 3} propertyPath: m_Text value: "\u6536\u56DE\u68AF\u5B50" @@ -230512,6 +230520,7 @@ MonoBehaviour: mensuo01: {fileID: 601364445} guimenbox: {fileID: 522830941} fengy: {fileID: 1143738318} + isPlayerOnLadder: 0 --- !u!114 &6121626523908351181 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/SXElectricityInformationAcquisition/Assets/ToolManager.cs b/SXElectricityInformationAcquisition/Assets/ToolManager.cs index 7b6cb757..ee9c48ba 100644 --- a/SXElectricityInformationAcquisition/Assets/ToolManager.cs +++ b/SXElectricityInformationAcquisition/Assets/ToolManager.cs @@ -28,11 +28,17 @@ public class ToolManager : MonoBehaviour /// public Button[] RetractBtn; - bool inthis; + public bool inthis = false; + public static ToolManager instans; + + private void Awake() + { + instans = this; + } void Start() { - + //inthis = true; generateAreaScript = generateArea.GetComponent(); MotionEngine.GetModule().OnUIEvent += UIEvent; @@ -73,63 +79,146 @@ public class ToolManager : MonoBehaviour { ui.SetActive(false); }); - MotionEngine.GetModule().OnStringEvent += HandleStringEvent; + MotionEngine.GetModule().OnStringEvent += HandleStringEvents; + + //MotionEngine.GetModule().OnStringEvent += HandleStringEvent; } + private void Update() + { + //if (RoleMove.instance.isup) + //{ + // MotionEngine.GetModule().OnStringEvent += HandleStringEvent; + // Debug.Log("ϣ"); + //} + //else + //{ + // MotionEngine.GetModule().OnStringEvent -= HandleStringEvent; + // Debug.Log("ϣ"); + //} + Debug.Log("Ƿϣ" + RoleMove.instance.isup); + } private void UIEvent() { ui.SetActive(true); } - - private void HandleStringEvent(string message) -{ - if (generateAreaScript.IsPlayerInArea()) + + public void HandleTiZiEvent(string message) { - if (message == "") + if (generateAreaScript.IsPlayerInArea()) { - Tool[0].gameObject.SetActive(true); - Ladder.instance.Init(); - //Ladder.instance.smr.SetBlendShapeWeight(0, 0); + if (message == "") + { + Tool[0].gameObject.SetActive(true); + Ladder.instance.Init(); + } } - if (message == "֤") + } + public void HandleStringEvent(string message) + { + if (generateAreaScript.IsPlayerInArea()) { - Tool[1].gameObject.SetActive(true); - } - if (message == "ǯ") - { - Tool[2].gameObject.SetActive(true); + if (message == "") + { + Tool[0].gameObject.SetActive(true); + Ladder.instance.Init(); + } + if (message == "֤") + { + Tool[1].gameObject.SetActive(true); + } + if (message == "ǯ") + { + Tool[2].gameObject.SetActive(true); RetractBtn[0].gameObject.SetActive(true); - } - if (message == "") - { - Tool[3].gameObject.SetActive(true); + } + if (message == "") + { + Tool[3].gameObject.SetActive(true); RetractBtn[1].gameObject.SetActive(true); } - if (message == "˿") - { - Tool[4].gameObject.SetActive(true); + if (message == "˿") + { + Tool[4].gameObject.SetActive(true); RetractBtn[2].gameObject.SetActive(true); } - if (message == "Ե") - { - Tool[5].gameObject.SetActive(true); + if (message == "Ե") + { + Tool[5].gameObject.SetActive(true); RetractBtn[3].gameObject.SetActive(true); } - if (message == "lͼ") - { - Tool[6].gameObject.SetActive(true); + if (message == "lͼ") + { + Tool[6].gameObject.SetActive(true); RetractBtn[4].gameObject.SetActive(true); } - if (message == "װӡ") - { - Tool[7].gameObject.SetActive(true); + if (message == "װӡ") + { + Tool[7].gameObject.SetActive(true); RetractBtn[5].gameObject.SetActive(true); } - Debug.Log("Received message: " + message); + Debug.Log("Received message: " + message); + } } -} } + public void HandleStringEvents(string message) + { + if (generateAreaScript.IsPlayerInArea()) + { + if (message == "") + { + Tool[0].gameObject.SetActive(true); + Ladder.instance.Init(); + } + if (message == "") + { + Tool[3].gameObject.SetActive(true); + RetractBtn[1].gameObject.SetActive(true); + } + } + if (RoleMove.instance.isup) + { + + if (generateAreaScript.IsPlayerInArea()) + { + if (message == "֤") + { + Tool[1].gameObject.SetActive(true); + } + if (message == "ǯ") + { + Tool[2].gameObject.SetActive(true); + RetractBtn[0].gameObject.SetActive(true); + } + + if (message == "˿") + { + Tool[4].gameObject.SetActive(true); + RetractBtn[2].gameObject.SetActive(true); + } + if (message == "Ե") + { + Tool[5].gameObject.SetActive(true); + RetractBtn[3].gameObject.SetActive(true); + } + + if (message == "lͼ") + { + Tool[6].gameObject.SetActive(true); + RetractBtn[4].gameObject.SetActive(true); + } + if (message == "װӡ") + { + Tool[7].gameObject.SetActive(true); + RetractBtn[5].gameObject.SetActive(true); + } + + Debug.Log("Received message: " + message); + } + } + } +} diff --git a/SXElectricityInformationAcquisition/Assets/ToolsManager.cs b/SXElectricityInformationAcquisition/Assets/ToolsManager.cs deleted file mode 100644 index 7d20033b..00000000 --- a/SXElectricityInformationAcquisition/Assets/ToolsManager.cs +++ /dev/null @@ -1,45 +0,0 @@ -using UnityEngine; -using UnityEngine.UI; -using System.Collections.Generic; - -public class ToolsManager : MonoBehaviour -{ - [System.Serializable] - public class Tool - { - public GameObject toolObject; - public Button returnButton; - [HideInInspector] - public Vector3 originalPosition; - [HideInInspector] - public Quaternion originalRotation; - } - - public List tools; - - void Start() - { - foreach (var tool in tools) - { - // ÿߵԭʼλúת - tool.originalPosition = tool.toolObject.transform.localPosition; - tool.originalRotation = tool.toolObject.transform.localRotation; - - // Ϊÿťӵ¼ - tool.returnButton.onClick.AddListener(ResetAllTools); - } - } - - // йߵԭʼλò - public void ResetAllTools() - { - foreach (var tool in tools) - { - tool.toolObject.transform.localPosition = tool.originalPosition; - tool.toolObject.transform.localRotation = tool.originalRotation; - tool.toolObject.SetActive(false); - } - } -} - - diff --git a/SXElectricityInformationAcquisition/Assets/ToolsManager.cs.meta b/SXElectricityInformationAcquisition/Assets/ToolsManager.cs.meta deleted file mode 100644 index badec095..00000000 --- a/SXElectricityInformationAcquisition/Assets/ToolsManager.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 91bb429240832294496ccae011ddc438 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/SXElectricityInformationAcquisition/Assets/taoruiqi/LadderTrigger.cs b/SXElectricityInformationAcquisition/Assets/taoruiqi/LadderTrigger.cs index 8988fc4a..8ecff84c 100644 --- a/SXElectricityInformationAcquisition/Assets/taoruiqi/LadderTrigger.cs +++ b/SXElectricityInformationAcquisition/Assets/taoruiqi/LadderTrigger.cs @@ -1,3 +1,4 @@ +using MotionFramework; using System.Collections; using System.Collections.Generic; using ToolsPack; @@ -6,7 +7,6 @@ using UnityEngine.UI; public class LadderTrigger : MonoBehaviour { - //public ToolsPackGameObjectComponent ladder; /// /// /// @@ -41,8 +41,12 @@ public class LadderTrigger : MonoBehaviour /// /// Ӷ /// - public SkinnedMeshRenderer ladderski; + public SkinnedMeshRenderer ladderski; + /// + /// жǷ + /// + public bool isPlayerOnLadder = false; public void Awake() { instance = this; @@ -63,8 +67,8 @@ public class LadderTrigger : MonoBehaviour RoleMove.instance.isup = true; }); //Ӱť - DownladderBtn.onClick.AddListener(() => - { + DownladderBtn.onClick.AddListener(() => + { RoleMove.instance.isup = false; FirstPersonController.instance.playerCanMove = true; CameraPlayer.GetComponent().enabled = true; @@ -74,14 +78,15 @@ public class LadderTrigger : MonoBehaviour TakeBackBtn.gameObject.SetActive(true); CameraPlayer.GetComponent().useGravity = true; CameraPlayer.GetComponentInChildren().fieldOfView = 60; + TooslManager.instance.ResetAllTools(); }); //ջӰť TakeBackBtn.onClick.AddListener(() => { UpladderBtn.gameObject.SetActive(false); - LadderObj.gameObject.SetActive (false); + LadderObj.gameObject.SetActive(false); CameraPlayer.GetComponentInChildren().fieldOfView = 60; - + }); } @@ -93,8 +98,10 @@ public class LadderTrigger : MonoBehaviour TakeBackBtn.gameObject.SetActive(true); //FirstPersonController.instance.playerCanMove = false; Debug.Log(other.name); + // isPlayerOnLadder = true; //ladder.OnPersonClose(); } + } private void OnTriggerExit(Collider other) { @@ -103,7 +110,7 @@ public class LadderTrigger : MonoBehaviour UpladderBtn.gameObject.SetActive(false); TakeBackBtn.gameObject.SetActive(false); Debug.Log(other.name); - //ladder.OnPersonAway(); + //isPlayerOnLadder = false; } } } diff --git a/SXElectricityInformationAcquisition/Assets/taoruiqi/Script/Field observation.cs b/SXElectricityInformationAcquisition/Assets/taoruiqi/Script/Field observation.cs index af4e6d36..11939b7b 100644 --- a/SXElectricityInformationAcquisition/Assets/taoruiqi/Script/Field observation.cs +++ b/SXElectricityInformationAcquisition/Assets/taoruiqi/Script/Field observation.cs @@ -9,6 +9,7 @@ using HighlightPlus; public class Fieldobservation : MonoBehaviour { + public static Fieldobservation Instance; /// /// /// @@ -77,6 +78,15 @@ public class Fieldobservation : MonoBehaviour public BoxCollider guimenbox; public GameObject fengy; + + /// + /// жǷ + /// + public bool isPlayerOnLadder = false; + private void Awake() + { + Instance = this; + } //public HighlightEffect _highlight; void Start() { @@ -95,10 +105,10 @@ public class Fieldobservation : MonoBehaviour if (hit.collider.gameObject.name == "_͸") { StartCoroutine(IEparentoverSeal()); - - BOXseal[0].enabled = true; - BOXseal[1].enabled = true; - //isbox = false; + + BOXseal[0].enabled = true; + BOXseal[1].enabled = true; + //isbox = false; MotionEngine.GetModule().HandleClick(hit.collider.gameObject.name); @@ -109,7 +119,7 @@ public class Fieldobservation : MonoBehaviour if (isbox) { parentoverSeal[0].gameObject.SetActive(true); - isbox = false; + isbox = false; } MotionEngine.GetModule().HandleClick(hit.collider.gameObject.name); } @@ -118,7 +128,7 @@ public class Fieldobservation : MonoBehaviour if (isbox) { parentoverSeal[1].gameObject.SetActive(true); - guimenkashuan.enabled = true; + guimenkashuan.enabled = true; isbox = false; } MotionEngine.GetModule().HandleClick(hit.collider.gameObject.name); @@ -128,9 +138,9 @@ public class Fieldobservation : MonoBehaviour StartCoroutine(IEguimenkashuan()); //if (isbox) //{ - guimenbox.GetComponent().enabled = true; - isbox = false; - // } + guimenbox.GetComponent().enabled = true; + isbox = false; + // } MotionEngine.GetModule().HandleClick(hit.collider.gameObject.name); } if (hit.collider.gameObject.name == "ŷӡboxײ") @@ -143,6 +153,22 @@ public class Fieldobservation : MonoBehaviour } } + private void OnTriggerEnter(Collider other) + { + if (other.gameObject.name == "UptheladderPos") + { + isPlayerOnLadder = true; + Debug.Log(other.name); + //ladder.OnPersonClose(); + } + if (other.gameObject.name == "Ƿ񵽴ﳡȡײ") + { + isPlayerOnLadder = false; + Debug.Log(other.name); + //ladder.OnPersonClose(); + } + } + /// /// û뿪npc水ťʧ /// @@ -153,22 +179,27 @@ public class Fieldobservation : MonoBehaviour { ExclamationPointBtn.gameObject.SetActive(false); } + } + public bool IsPlayerOnLadder() + { + return isPlayerOnLadder; + } /// /// ͸ϵķӡ /// /// IEnumerator IEparentoverSeal() { - Transparentover.transform.localPosition=new Vector3(0, 0, 0); + Transparentover.transform.localPosition = new Vector3(0, 0, 0); yield return new WaitForSeconds(1f); screw[0].gameObject.SetActive(true); yield return new WaitForSeconds(0.5f); screw[0].transform.localPosition = new Vector3(-0.07357633f, -0.01137948f, 0.003414989f); screw[1].gameObject.SetActive(true); yield return new WaitForSeconds(1.5f); - screw[1].transform.localPosition = new Vector3(0.07394123f, 0.013731f, 0.003414989f); + screw[1].transform.localPosition = new Vector3(0.07394123f, 0.013731f, 0.003414989f); } diff --git a/SXElectricityInformationAcquisition/Assets/taoruiqi/Script/ToolsManager.cs b/SXElectricityInformationAcquisition/Assets/taoruiqi/Script/ToolsManager.cs index f7c618bc..6247136d 100644 --- a/SXElectricityInformationAcquisition/Assets/taoruiqi/Script/ToolsManager.cs +++ b/SXElectricityInformationAcquisition/Assets/taoruiqi/Script/ToolsManager.cs @@ -25,11 +25,21 @@ public class TooslManager : MonoBehaviour public List tools; + /// + /// ʹõĹ + /// + public GameObject[] onladderTools; + public Transform PlayercameraTrans; public static TooslManager instance; - public void Awake() + /// + /// Ladderű + /// + public Fieldobservation Fieldobservation; + + public void Awake() { instance = this; } @@ -41,12 +51,15 @@ public class TooslManager : MonoBehaviour // ÿߵԭʼλúת tool.originalPosition = tool.toolObject.transform.localPosition; tool.originalRotation = tool.toolObject.transform.localRotation; - Debug.Log("һλã"+ tool.originalPosition); + Debug.Log("һλã" + tool.originalPosition); // Ϊÿťӵ¼ tool.returnButton.onClick.AddListener(ResetAllTools); } } + void Update() + { + } // йߵԭʼλò public void ResetAllTools() { @@ -59,4 +72,35 @@ public class TooslManager : MonoBehaviour Debug.Log("ڶλã" + tool.originalPosition); } } + + ///// + ///// Ͻ + ///// + //void DisableTools() + //{ + // foreach (GameObject tool in onladderTools) + // { + // // ù + // tool.SetActive(false); + // } + //} + + ///// + ///// Ͽʹ + ///// + //void UseTools() + //{ + // foreach (GameObject tool in onladderTools) + // { + // // ùߣģʹùߵЧ + // tool.SetActive(true); + // } + //} + void ToggleTools(bool activate) + { + foreach (GameObject tool in onladderTools) + { + tool.SetActive(activate); + } + } }