From 441b9f93248bc41953be29544f91ccbdcc84f345 Mon Sep 17 00:00:00 2001 From: Yogi <1273750265@qq.com> Date: Sun, 1 Dec 2024 15:48:43 +0800 Subject: [PATCH] update random script & Debug Event --- .../SerialController_BinaryDelimited.prefab | Bin 4676 -> 0 bytes ...rialController_BinaryDelimited.prefab.meta | 8 --- Assets/Scenes/MainScene.unity | 50 ++++++++++++++---- Assets/Scripts/AudioPlayControl.cs | 2 + Assets/Scripts/GameManager.cs | 13 +++-- 5 files changed, 53 insertions(+), 20 deletions(-) delete mode 100644 Assets/Ardity/Prefabs/SerialController_BinaryDelimited.prefab delete mode 100644 Assets/Ardity/Prefabs/SerialController_BinaryDelimited.prefab.meta diff --git a/Assets/Ardity/Prefabs/SerialController_BinaryDelimited.prefab b/Assets/Ardity/Prefabs/SerialController_BinaryDelimited.prefab deleted file mode 100644 index 8bf4fafa8f3f8f3e6391a6cfdd8527792a466276..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4676 zcmds4ZD<@t7@oa+S-+Cjk5*eXX;T%kp|P!sw)N8VQZtpgiZSQX5-ZthG z=@!&q6`@u{L5P0@v0xDjiXi?dqJkEL{!uAaC{%y=K?{P^#^;&2*`2wB67i2XVY2f+ zJM+xD@67wmoDdza3NdfJ5Mr(n9mnt#t9n-T^p5n3OH)%*PBVa?n(%LG>aj)bcU{_a z^!KlZ+E*-#AKbYV=(ngD)YBOe-zP+jAyY8X62igXJ53_~z!5QNoTRcP#C53b&+$&o z_ZjgucoxIH8kMuEF-_t$7+1n3Ps-IKdceO1*cGTPsH%TPoC3ZPHu+nL$9&i1^n!<# zcw2%uOa6rzLvC^@o@VhV+I#E$=Oq1GL=ArKgH1oLBra>K<>yrfZu-eFs(*{vj5$Nt z^yeDlG2gXXeqKvFOT5kUvz@rCZDKooq@T1q5?t{gfK7fZ@QnQPh-atsbA4vwzdpfL z9A1RYZ@MAD?Ks?M;AR}=C%9U#*I?7n1qp7i*G&m-uh-26&UIlN=+D9gZ?V>8k%623 z+>+pqcnLi3!Y0qH37)ZdZZmL`r!&DFu@XEV!X{5wg4;aY?<&q2YdFA`(*cN{9l-O_$f1bg;+`Dn-+@xY(=z&qrXgK@9WAC$*}3g)cJ zxj4IWm|cP(+T@nKZE`SxEmifd?j@svt?>A+1s@+jaO8>OXU_I~_scyl7vdl)6a6Rx z@=pcl6oiNiAq59d3J!&Z8Z+Hrh!ka}mHr_he{9aatt3=S>OTp2& z`Mnezg)0FcfXx_Ca9Akp6t4FW2l`LJ5wVP$<-Zi1EOFa^DL5EH+!U@RiyG-WX1GUO_E9^t(@zJBCnGTqXyiX7veeW z7I#FUUnw%b@=_eOy5oahbyWA*Qtit}{^myN-N+`1G9Z zbN{@1{&UCP>O5Dy7@dFRj$cphJNo5d-}woKB1UDn+mMcyq~HZZce&pT|3^ugWNIK5 zjEVfs(3i&Hk@^wBZN&GC&nQyh=em?BNg-};UHO|q_P3=h{mn4_2zO%1W2NN3J;GPO zPkn?taZEogeszQsw^Lpn;R-je2K45LzlysCGCK5dJE-6mk88(zujJN5*`3%~2|c%f z+XA~*r7x4kKX~JnWo7;O&0l?QELhkgc=R1aWlZ1vZSlmKj=ADfw8v00sP}$$;liO^ zuRF`pp#VF*Y723u_C63bR(yV-y=D2!!~K&N4~;Il_|XY=Gz$4=Q?y@~>#x6u{;_Dk z+1CED-HE!x3w^iLA5@|+C_(vluk$NzSVOq{vLAT`UMY4~BDYxd_<7Tc_Cr6-4%!c5 s+Hdncw!=fyZDNhM-HX<2=hOZ8)a#+yxDWfc4X%oL{ut#P)`tE62HU5^C;$Ke diff --git a/Assets/Ardity/Prefabs/SerialController_BinaryDelimited.prefab.meta b/Assets/Ardity/Prefabs/SerialController_BinaryDelimited.prefab.meta deleted file mode 100644 index 25f6317..0000000 --- a/Assets/Ardity/Prefabs/SerialController_BinaryDelimited.prefab.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e246aa68d79c3e6489397d781fa90434 -timeCreated: 1490930520 -licenseType: Free -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index 4e6c768..ee6e8a8 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -290,7 +290,7 @@ MonoBehaviour: startMsg: START stopMsg: STOP videoControl: {fileID: 1041319595} - brainTrans: {fileID: 2000524570} + brainTrans: {fileID: 1881786632} dt: 0.1 isTestInput: 1 --- !u!1 &748090405 @@ -670,15 +670,15 @@ PrefabInstance: serializedVersion: 2 m_Modification: serializedVersion: 3 - m_TransformParent: {fileID: 0} + m_TransformParent: {fileID: 1881786632} m_Modifications: - target: {fileID: -8679921383154817045, guid: 89b9ffd9832690d4ba423ff477aa1d06, type: 3} propertyPath: m_LocalPosition.x - value: 0 + value: 0.57 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: 89b9ffd9832690d4ba423ff477aa1d06, type: 3} propertyPath: m_LocalPosition.y - value: -1.68 + value: -1.92 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: 89b9ffd9832690d4ba423ff477aa1d06, type: 3} propertyPath: m_LocalPosition.z @@ -690,15 +690,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: 89b9ffd9832690d4ba423ff477aa1d06, type: 3} propertyPath: m_LocalRotation.x - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: 89b9ffd9832690d4ba423ff477aa1d06, type: 3} propertyPath: m_LocalRotation.y - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: 89b9ffd9832690d4ba423ff477aa1d06, type: 3} propertyPath: m_LocalRotation.z - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: 89b9ffd9832690d4ba423ff477aa1d06, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -718,7 +718,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 919132149155446097, guid: 89b9ffd9832690d4ba423ff477aa1d06, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] @@ -819,6 +819,38 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 31.065, y: -41.801, z: -3.726} +--- !u!1 &1881786631 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1881786632} + m_Layer: 0 + m_Name: BrainCenter + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1881786632 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1881786631} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 2000524570} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!4 &2000524570 stripped Transform: m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 89b9ffd9832690d4ba423ff477aa1d06, type: 3} @@ -833,6 +865,6 @@ SceneRoots: - {fileID: 748090407} - {fileID: 1160156452} - {fileID: 626615866} - - {fileID: 1785240159} + - {fileID: 1881786632} - {fileID: 1793753137} - {fileID: 718402601} diff --git a/Assets/Scripts/AudioPlayControl.cs b/Assets/Scripts/AudioPlayControl.cs index 7fe7485..02041ac 100644 --- a/Assets/Scripts/AudioPlayControl.cs +++ b/Assets/Scripts/AudioPlayControl.cs @@ -21,6 +21,8 @@ public class AudioPlayControl : MonoBehaviour player.clip = startAudio; player.Play(); await Task.Delay((int)(1000 * player.clip.length)); + if (this == null || this.gameObject == null) + return; player.Stop(); this.gameObject.SetActive(false); } diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 5147cce..934c9d2 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -17,6 +17,11 @@ public class GameManager : MonoBehaviour public void Awake() { SampleMessageListener.OnReceivedMSG += OnReceivedMessage; + brainTrans.gameObject.SetActive(false); + } + private void OnDestroy() + { + SampleMessageListener.OnReceivedMSG -= OnReceivedMessage; } private void OnReceivedMessage(string msgStr) { @@ -94,14 +99,16 @@ public class GameManager : MonoBehaviour { OnReceivedMessage(startMsg); } - else if (Input.GetKeyDown(KeyCode.Alpha2)) + if (Input.GetKey(KeyCode.Alpha2)) { - OnReceivedMessage("3,3,3,3,3,3"); + float randomF() => Random.Range(0.0f, 1.0f); + OnReceivedMessage($"{randomF()},{randomF()},{randomF()},{randomF()},{randomF()},{randomF()}"); } else if (Input.GetKeyDown(KeyCode.Alpha3)) { OnReceivedMessage(stopMsg); - }else if (Input.GetKeyDown(KeyCode.F)) + } + else if (Input.GetKeyDown(KeyCode.F)) { videoControl.StopPlay(); JustGamePlayNoAnim();