From 7fa19b888e7d75bdf9481384c364f2bb43b32dec Mon Sep 17 00:00:00 2001 From: tigerchen Date: Wed, 27 Nov 2019 17:13:27 +0800 Subject: [PATCH] add tuio code --- .../Assets/Scenes/Ice.unity | 164 +++++++++--------- .../Assets/Scripts/DebugUI.cs | 21 ++- .../Assets/Visual Effect Graphs/frozenVFX.vfx | 6 +- 3 files changed, 104 insertions(+), 87 deletions(-) diff --git a/Unity-19050-01_ForstCoronation/Assets/Scenes/Ice.unity b/Unity-19050-01_ForstCoronation/Assets/Scenes/Ice.unity index 92e1b80..1930577 100644 --- a/Unity-19050-01_ForstCoronation/Assets/Scenes/Ice.unity +++ b/Unity-19050-01_ForstCoronation/Assets/Scenes/Ice.unity @@ -826,6 +826,82 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &927952675 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3df29e7cc05fbec4aa43e06ea875565d, type: 3} + m_Name: + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + rotation: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 360 + skyIntensityMode: + m_OverrideState: 0 + m_Value: 0 + exposure: + m_OverrideState: 0 + m_Value: 0 + multiplier: + m_OverrideState: 0 + m_Value: 1 + min: 0 + upperHemisphereLuxValue: + m_OverrideState: 0 + m_Value: 1 + min: 0 + desiredLuxValue: + m_OverrideState: 0 + m_Value: 20000 + updateMode: + m_OverrideState: 0 + m_Value: 0 + updatePeriod: + m_OverrideState: 0 + m_Value: 0 + min: 0 + includeSunInBaking: + m_OverrideState: 0 + m_Value: 0 + sunSize: + m_OverrideState: 0 + m_Value: 0.04 + min: 0 + max: 1 + sunSizeConvergence: + m_OverrideState: 0 + m_Value: 5 + min: 1 + max: 10 + atmosphereThickness: + m_OverrideState: 0 + m_Value: 1 + min: 0 + max: 5 + skyTint: + m_OverrideState: 0 + m_Value: {r: 0.5, g: 0.5, b: 0.5, a: 1} + hdr: 0 + showAlpha: 1 + showEyeDropper: 1 + groundColor: + m_OverrideState: 0 + m_Value: {r: 0.369, g: 0.349, b: 0.341, a: 1} + hdr: 0 + showAlpha: 1 + showEyeDropper: 1 + enableSunDisk: + m_OverrideState: 0 + m_Value: 1 --- !u!1 &1111578216 GameObject: m_ObjectHideFlags: 0 @@ -881,8 +957,8 @@ MonoBehaviour: m_ExecuteInEditor: 1 m_Bindings: - {fileID: 1111578222} - - {fileID: 1111578227} - {fileID: 1111578217} + - {fileID: 1111578227} m_VisualEffect: {fileID: 1111578220} --- !u!73398921 &1111578219 VFXRenderer: @@ -1059,82 +1135,6 @@ MonoBehaviour: m_Parameter: m_Name: _Emitter Target: {fileID: 1324214450} ---- !u!114 &1279790688 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 3df29e7cc05fbec4aa43e06ea875565d, type: 3} - m_Name: - m_EditorClassIdentifier: - active: 1 - m_AdvancedMode: 0 - rotation: - m_OverrideState: 0 - m_Value: 0 - min: 0 - max: 360 - skyIntensityMode: - m_OverrideState: 0 - m_Value: 0 - exposure: - m_OverrideState: 0 - m_Value: 0 - multiplier: - m_OverrideState: 0 - m_Value: 1 - min: 0 - upperHemisphereLuxValue: - m_OverrideState: 0 - m_Value: 1 - min: 0 - desiredLuxValue: - m_OverrideState: 0 - m_Value: 20000 - updateMode: - m_OverrideState: 0 - m_Value: 0 - updatePeriod: - m_OverrideState: 0 - m_Value: 0 - min: 0 - includeSunInBaking: - m_OverrideState: 0 - m_Value: 0 - sunSize: - m_OverrideState: 0 - m_Value: 0.04 - min: 0 - max: 1 - sunSizeConvergence: - m_OverrideState: 0 - m_Value: 5 - min: 1 - max: 10 - atmosphereThickness: - m_OverrideState: 0 - m_Value: 1 - min: 0 - max: 5 - skyTint: - m_OverrideState: 0 - m_Value: {r: 0.5, g: 0.5, b: 0.5, a: 1} - hdr: 0 - showAlpha: 1 - showEyeDropper: 1 - groundColor: - m_OverrideState: 0 - m_Value: {r: 0.369, g: 0.349, b: 0.341, a: 1} - hdr: 0 - showAlpha: 1 - showEyeDropper: 1 - enableSunDisk: - m_OverrideState: 0 - m_Value: 1 --- !u!1 &1324214445 GameObject: m_ObjectHideFlags: 0 @@ -1275,7 +1275,7 @@ PrefabInstance: - target: {fileID: 114540009425154000, guid: 1f68bf7cec2600e49a46d2f0554453c8, type: 3} propertyPath: AddTuioBlobEvent.m_PersistentCalls.m_Calls.Array.size - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 114540009425154000, guid: 1f68bf7cec2600e49a46d2f0554453c8, type: 3} @@ -1285,7 +1285,7 @@ PrefabInstance: - target: {fileID: 114540009425154000, guid: 1f68bf7cec2600e49a46d2f0554453c8, type: 3} propertyPath: RemoveTuioBlobEvent.m_PersistentCalls.m_Calls.Array.size - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 114540009425154000, guid: 1f68bf7cec2600e49a46d2f0554453c8, type: 3} @@ -1493,8 +1493,8 @@ MonoBehaviour: Emitter_x: 2.5 Target_x: -2.5 growingSpeed: 0.015 - fadeSpeed: 0 - smooth: 0 + fadeSpeed: 15 + smooth: 0.3 --- !u!4 &1482770261 Transform: m_ObjectHideFlags: 0 @@ -1869,7 +1869,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Profile: {fileID: 11400000, guid: 61403f0eeedb6b84fafb386b66e1edae, type: 2} m_StaticLightingSkyUniqueID: 2 - m_SkySettings: {fileID: 1279790688} + m_SkySettings: {fileID: 927952675} m_SkySettingsFromProfile: {fileID: -3409118194237871670, guid: 61403f0eeedb6b84fafb386b66e1edae, type: 2} --- !u!114 &1937584651 diff --git a/Unity-19050-01_ForstCoronation/Assets/Scripts/DebugUI.cs b/Unity-19050-01_ForstCoronation/Assets/Scripts/DebugUI.cs index eeb16c7..9557f58 100644 --- a/Unity-19050-01_ForstCoronation/Assets/Scripts/DebugUI.cs +++ b/Unity-19050-01_ForstCoronation/Assets/Scripts/DebugUI.cs @@ -4,6 +4,7 @@ using UnityEngine; using UnityEngine.Experimental.VFX; using UnityEngine.UI; using UltraCombos.Configuration; +using TUIO; public class DebugUI : MonoBehaviour { @@ -41,6 +42,7 @@ public class DebugUI : MonoBehaviour float lerp_val; Vector3 final_pos; bool showObject; + int cur_blob_count, pre_blob_count; void Start() { @@ -50,12 +52,26 @@ public class DebugUI : MonoBehaviour spawn_t = 0; total_t = 0; lerp_val = 0; + cur_blob_count = 0; } // Update is called once per frame void Update() { + pre_blob_count = cur_blob_count; + cur_blob_count = TUIOManager.Instance.touches.Count; + + if(cur_blob_count == 0 && stat == "completed") + { + enterVanish(); + } + else if (cur_blob_count > 0 && stat == "wait") + { + enterGrow(); + } + updateVFX(); + if (Input.GetKeyDown(KeyCode.A)) { debugMode = !debugMode; @@ -106,7 +122,6 @@ public class DebugUI : MonoBehaviour lerp_val = Mathf.Clamp(lerp_val, 0, 1); vfx.SetFloat("_LerpVal", lerp_val); - Transform base_trans = baseEmitter.GetComponent(); Transform targ_trans = target.GetComponent(); base_trans.position = new Vector3(Emitter_x, 0, 0); @@ -130,17 +145,18 @@ public class DebugUI : MonoBehaviour { enterVanish(); } - button.GetComponent().text = stat; } public void enterGrow() { + setButtonInteractable(false); spawn_t = total_t; stat = "growing"; vfx.SendEvent("MouseDown"); vfx.SetBool("isGrowing", true); + button.GetComponent().text = stat; Debug.Log(stat); } @@ -151,6 +167,7 @@ public class DebugUI : MonoBehaviour stat = "vanishing"; vfx.SendEvent("MouseUp"); vfx.SetBool("isGrowing", false); + button.GetComponent().text = stat; Debug.Log(stat); } diff --git a/Unity-19050-01_ForstCoronation/Assets/Visual Effect Graphs/frozenVFX.vfx b/Unity-19050-01_ForstCoronation/Assets/Visual Effect Graphs/frozenVFX.vfx index 467a9e5..ac7f99a 100644 --- a/Unity-19050-01_ForstCoronation/Assets/Visual Effect Graphs/frozenVFX.vfx +++ b/Unity-19050-01_ForstCoronation/Assets/Visual Effect Graphs/frozenVFX.vfx @@ -90,7 +90,7 @@ MonoBehaviour: x: -1346 y: -436 width: 3249 - height: 2834 + height: 2833 --- !u!114 &114350483966674976 MonoBehaviour: m_ObjectHideFlags: 1 @@ -12573,7 +12573,7 @@ MonoBehaviour: inputSlot: {fileID: 8926484042661617349} - outputSlot: {fileID: 8926484042661617311} inputSlot: {fileID: 8926484042661617313} - position: {x: 86, y: -184} + position: {x: -1, y: -195} expandedSlots: [] expanded: 0 --- !u!114 &8926484042661617311 @@ -13566,7 +13566,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Parent: {fileID: 114350483966674976} m_Children: [] - m_UIPosition: {x: 212, y: -331} + m_UIPosition: {x: 159, y: -335} m_UICollapsed: 0 m_UISuperCollapsed: 0 m_InputSlots: