From ffa9d3b3bd0e7f16dea83a07495d207afc0e1b6c Mon Sep 17 00:00:00 2001 From: "home-tower\\Pascal" Date: Thu, 21 Dec 2023 21:26:12 +0100 Subject: [PATCH] - Fixed the Joystick, dropping a fruit is now easier and more precise - Fixed AudioSource not being correctly spacialized - Fixed an issue related to the "Next Fruit" picture, which sometimes showed the wrong pic --- Common/Code/JoystickLoop.asset | 56 +++++++++- Common/Code/JoystickLoop.cs | 10 +- Melon/Code/MelonGameLoop.asset | 2 +- Melon/Code/MelonGameLoop.cs | 7 +- Melon/Materials/MelonUI.mat | 2 +- Melon/SubPrefab/MelonGame.prefab | 179 ++++++++++++++++++------------- 6 files changed, 171 insertions(+), 85 deletions(-) diff --git a/Common/Code/JoystickLoop.asset b/Common/Code/JoystickLoop.asset index 04e33ff..3981de9 100644 --- a/Common/Code/JoystickLoop.asset +++ b/Common/Code/JoystickLoop.asset @@ -44,7 +44,7 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 3 + Data: 4 - Name: Entry: 7 Data: @@ -201,6 +201,60 @@ MonoBehaviour: - Name: Entry: 8 Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: _renderer + - Name: $v + Entry: 7 + Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: _renderer + - Name: k__BackingField + Entry: 7 + Data: 11|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: UnityEngine.MeshRenderer, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 11 + - Name: k__BackingField + Entry: 7 + Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib + - Name: + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 5 + Data: false + - Name: _fieldAttributes + Entry: 7 + Data: 12|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: - Name: Entry: 13 Data: diff --git a/Common/Code/JoystickLoop.cs b/Common/Code/JoystickLoop.cs index 05590a4..b2b40f1 100644 --- a/Common/Code/JoystickLoop.cs +++ b/Common/Code/JoystickLoop.cs @@ -12,6 +12,12 @@ public class JoystickLoop : UdonSharpBehaviour Transform _left, _right; float _ratio; // [0,1] + private MeshRenderer _renderer; + + private void Start() + { + _renderer = GetComponent(); + } public float GetRatio() { @@ -25,12 +31,12 @@ public void SetLeftAndRightTransform(Transform left, Transform right) private void Update() { - if (!_left || !_right) return; + if (!_left || !_right || !_renderer) return; //We project "transform.position" between _left and _right Vector3 a = _left.position; Vector3 b = _right.position; Vector3 ab = b - a; - Vector3 projectedVector = Vector3.Project(transform.position - a, ab) + a; + Vector3 projectedVector = Vector3.Project(_renderer.bounds.center - a, ab) + a; projectedVector = Vector3.ClampMagnitude(projectedVector - a, ab.magnitude) + a; projectedVector = Vector3.ClampMagnitude(projectedVector - b, ab.magnitude) + b; diff --git a/Melon/Code/MelonGameLoop.asset b/Melon/Code/MelonGameLoop.asset index ded8e62..2f57dca 100644 --- a/Melon/Code/MelonGameLoop.asset +++ b/Melon/Code/MelonGameLoop.asset @@ -578,7 +578,7 @@ MonoBehaviour: Data: 29|System.RuntimeType, mscorlib - Name: Entry: 1 - Data: UnityEngine.UI.Image, UnityEngine.UI + Data: UnityEngine.MeshRenderer, UnityEngine.CoreModule - Name: Entry: 8 Data: diff --git a/Melon/Code/MelonGameLoop.cs b/Melon/Code/MelonGameLoop.cs index 5357899..ee22ea6 100644 --- a/Melon/Code/MelonGameLoop.cs +++ b/Melon/Code/MelonGameLoop.cs @@ -23,7 +23,7 @@ public class MelonGameLoop : UdonSharpBehaviour public GameObject GameOverMessage; public MelonGameSettings MelonGameSettingsInstance; public TextMeshProUGUI Score; - public Image NextRankImage; + public MeshRenderer NextRankImage; public GameObject WaitMessage; public AudioSource Music; @@ -53,7 +53,8 @@ public class MelonGameLoop : UdonSharpBehaviour void Start() { - _gameState = GameState.FINISH; + _gameState = GameState.FINISH; + GameOver(); } @@ -296,7 +297,7 @@ public override void OnDeserialization() private void UpdateNextRankImage() { SetTextureOffset(NextRankImage.material, _nextRank); - float scale = (_nextRank + 1) * 0.2f + 0.2f; + float scale = (_nextRank + 1) + 1.0f; NextRankImage.transform.localScale = new Vector3(scale, scale, scale); } diff --git a/Melon/Materials/MelonUI.mat b/Melon/Materials/MelonUI.mat index 4c395b4..ee8cf2c 100644 --- a/Melon/Materials/MelonUI.mat +++ b/Melon/Materials/MelonUI.mat @@ -46,7 +46,7 @@ Material: - _MainTex: m_Texture: {fileID: 2800000, guid: 8486d1ed7c89b6f40975ddb178c1fa48, type: 3} m_Scale: {x: 0.25, y: 0.25} - m_Offset: {x: 0, y: 0} + m_Offset: {x: 0.75, y: 0} - _MetallicGlossMap: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} diff --git a/Melon/SubPrefab/MelonGame.prefab b/Melon/SubPrefab/MelonGame.prefab index 65967a1..ad9ada4 100644 --- a/Melon/SubPrefab/MelonGame.prefab +++ b/Melon/SubPrefab/MelonGame.prefab @@ -66,7 +66,7 @@ MonoBehaviour: GameOverMessage: {fileID: 5613897269331383670} MelonGameSettingsInstance: {fileID: 0} Score: {fileID: 334586890251980666} - NextRankImage: {fileID: 7867282436295721864} + NextRankImage: {fileID: 4412562579876855118} WaitMessage: {fileID: 5105919357326259949} Music: {fileID: 539418887288184057} AudioPlayer: {fileID: 139970195034749013} @@ -1016,6 +1016,105 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &1762280883607649194 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6736857184273864198} + - component: {fileID: 6119274388481134334} + - component: {fileID: 4412562579876855118} + - component: {fileID: 1646188448399045687} + m_Layer: 11 + m_Name: Plane + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6736857184273864198 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1762280883607649194} + m_LocalRotation: {x: -0.000002041459, y: 0.7071057, z: -0.70710796, w: 0.0000020936131} + m_LocalPosition: {x: 0, y: 0, z: -15} + m_LocalScale: {x: 4.5656, y: 4.5656, z: 4.5656} + m_Children: [] + m_Father: {fileID: 5594949107941096122} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 90.00001, y: 0, z: -180.00002} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: -13.7} + m_SizeDelta: {x: 50, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!33 &6119274388481134334 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1762280883607649194} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &4412562579876855118 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1762280883607649194} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 6d5f0f734dd145a40997fae2a2b7854d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &1646188448399045687 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1762280883607649194} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 4 + m_Convex: 0 + m_CookingOptions: 30 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} --- !u!1 &1821887110872502023 GameObject: m_ObjectHideFlags: 0 @@ -1373,7 +1472,7 @@ AudioSource: m_Curve: - serializedVersion: 3 time: 0 - value: 0 + value: 1 inSlope: 0 outSlope: 0 tangentMode: 0 @@ -2118,80 +2217,6 @@ MonoBehaviour: serializedPublicVariablesBytesString: Ai8AAAAAATIAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAFQAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AAAAAAAYBAAAAAAAAACcBBAAAAHQAeQBwAGUAAWgAAABTAHkAcwB0AGUAbQAuAEMAbwBsAGwAZQBjAHQAaQBvAG4AcwAuAEcAZQBuAGUAcgBpAGMALgBMAGkAcwB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YQBsAHUAZQACAAAABwUHBQcF publicVariablesUnityEngineObjects: [] publicVariablesSerializationDataFormat: 0 ---- !u!1 &3221807660852072166 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 5126809235251240594} - - component: {fileID: 4556442117988228488} - - component: {fileID: 7867282436295721864} - m_Layer: 11 - m_Name: Image - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &5126809235251240594 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3221807660852072166} - 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_Children: [] - m_Father: {fileID: 5594949107941096122} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: -13.7} - m_SizeDelta: {x: 50, y: 50} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &4556442117988228488 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3221807660852072166} - m_CullTransparentMesh: 0 ---- !u!114 &7867282436295721864 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3221807660852072166} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 2100000, guid: 6d5f0f734dd145a40997fae2a2b7854d, type: 2} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 0} - m_Type: 0 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 --- !u!1 &3242408151597173239 GameObject: m_ObjectHideFlags: 0 @@ -3295,7 +3320,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 3046230587920747868} - - {fileID: 5126809235251240594} + - {fileID: 6736857184273864198} - {fileID: 3138324780036466484} m_Father: {fileID: 167475114544584253} m_RootOrder: 1