Skip to content

Commit

Permalink
- Fixed the Joystick, dropping a fruit is now easier and more precise
Browse files Browse the repository at this point in the history
- Fixed AudioSource not being correctly spacialized
- Fixed an issue related to the "Next Fruit" picture, which sometimes showed the wrong pic
  • Loading branch information
home-tower\Pascal committed Dec 21, 2023
1 parent ee1696e commit ffa9d3b
Show file tree
Hide file tree
Showing 6 changed files with 171 additions and 85 deletions.
56 changes: 55 additions & 1 deletion Common/Code/JoystickLoop.asset
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 3
Data: 4
- Name:
Entry: 7
Data:
Expand Down Expand Up @@ -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: <Name>k__BackingField
Entry: 1
Data: _renderer
- Name: <UserType>k__BackingField
Entry: 7
Data: 11|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.MeshRenderer, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 11
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>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:
Expand Down
10 changes: 8 additions & 2 deletions Common/Code/JoystickLoop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ public class JoystickLoop : UdonSharpBehaviour
Transform _left, _right;

float _ratio; // [0,1]
private MeshRenderer _renderer;

private void Start()
{
_renderer = GetComponent<MeshRenderer>();
}

public float GetRatio()
{
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Melon/Code/MelonGameLoop.asset
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions Melon/Code/MelonGameLoop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -53,7 +53,8 @@ public class MelonGameLoop : UdonSharpBehaviour

void Start()
{
_gameState = GameState.FINISH;
_gameState = GameState.FINISH;

GameOver();
}

Expand Down Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion Melon/Materials/MelonUI.mat
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
179 changes: 102 additions & 77 deletions Melon/SubPrefab/MelonGame.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1373,7 +1472,7 @@ AudioSource:
m_Curve:
- serializedVersion: 3
time: 0
value: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
Expand Down Expand Up @@ -2118,80 +2217,6 @@ MonoBehaviour:
serializedPublicVariablesBytesString: Ai8AAAAAATIAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAFQAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AAAAAAAYBAAAAAAAAACcBBAAAAHQAeQBwAGUAAWgAAABTAHkAcwB0AGUAbQAuAEMAbwBsAGwAZQBjAHQAaQBvAG4AcwAuAEcAZQBuAGUAcgBpAGMALgBMAGkAcwB0AGAAMQBbAFsAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4ALgBJAG4AdABlAHIAZgBhAGMAZQBzAC4ASQBVAGQAbwBuAFYAYQByAGkAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AXQBdACwAIABtAHMAYwBvAHIAbABpAGIAAQEJAAAAVgBhAHIAaQBhAGIAbABlAHMALwEAAAABaAAAAFMAeQBzAHQAZQBtAC4AQwBvAGwAbABlAGMAdABpAG8AbgBzAC4ARwBlAG4AZQByAGkAYwAuAEwAaQBzAHQAYAAxAFsAWwBWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAEkAbgB0AGUAcgBmAGEAYwBlAHMALgBJAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlACwAIABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgBdAF0ALAAgAG0AcwBjAG8AcgBsAGkAYgABAAAABgEAAAAAAAAAAi8CAAAAAUkAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAGAAMQBbAFsAUwB5AHMAdABlAG0ALgBJAG4AdAAzADIALAAgAG0AcwBjAG8AcgBsAGkAYgBdAF0ALAAgAFYAUgBDAC4AVQBkAG8AbgAuAEMAbwBtAG0AbwBuAAIAAAAGAgAAAAAAAAAnAQQAAAB0AHkAcABlAAEXAAAAUwB5AHMAdABlAG0ALgBTAHQAcgBpAG4AZwAsACAAbQBzAGMAbwByAGwAaQBiACcBCgAAAFMAeQBtAGIAbwBsAE4AYQBtAGUAAR8AAABfAF8AXwBVAGQAbwBuAFMAaABhAHIAcABCAGUAaABhAHYAaQBvAHUAcgBWAGUAcgBzAGkAbwBuAF8AXwBfACcBBAAAAHQAeQBwAGUAARYAAABTAHkAcwB0AGUAbQAuAEkAbgB0ADMAMgAsACAAbQBzAGMAbwByAGwAaQBiABcBBQAAAFYAYQBsAHUAZQACAAAABwUHBQcF
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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ffa9d3b

Please sign in to comment.