From 5dc42fec95401029ace0689dcf986c0678bb3094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20LUDWIG?= Date: Mon, 20 Jan 2025 17:02:37 +0100 Subject: [PATCH] feat: detect win (#33) --- .../BackgroundSkin/menu-background.png.meta | 16 +- Assets/InGame/ButtonSkin/BackBtn.png.meta | 16 +- Assets/InGame/ButtonSkin/ExitButton.png.meta | 16 +- .../InGame/ButtonSkin/LevelStatsBtn.png.meta | 16 +- Assets/InGame/ButtonSkin/PlayButton.png.meta | 16 +- .../InGame/ButtonSkin/SettingsButton.png.meta | 16 +- Assets/MainMenu.cs | 2 +- Assets/Scenes/LevelScene.unity | 139 +++++++++++++++- Assets/Scenes/SelectLevelScene.unity | 152 ------------------ Assets/Scripts/PlayerScript.cs | 5 + Assets/SelectLevelMenu.cs | 4 +- ProjectSettings/TagManager.asset | 1 + 12 files changed, 236 insertions(+), 163 deletions(-) diff --git a/Assets/InGame/BackgroundSkin/menu-background.png.meta b/Assets/InGame/BackgroundSkin/menu-background.png.meta index dea628a..80d9dc1 100644 --- a/Assets/InGame/BackgroundSkin/menu-background.png.meta +++ b/Assets/InGame/BackgroundSkin/menu-background.png.meta @@ -96,6 +96,19 @@ TextureImporter: ignorePlatformSupport: 0 androidETC2FallbackOverride: 0 forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 spriteSheet: serializedVersion: 2 sprites: @@ -134,7 +147,8 @@ TextureImporter: secondaryTextures: [] spriteCustomMetadata: entries: [] - nameFileIdTable: {} + nameFileIdTable: + menu-background_0: -5548395039409485977 mipmapLimitGroupName: pSDRemoveMatte: 0 userData: diff --git a/Assets/InGame/ButtonSkin/BackBtn.png.meta b/Assets/InGame/ButtonSkin/BackBtn.png.meta index 8c12ef3..780497b 100644 --- a/Assets/InGame/ButtonSkin/BackBtn.png.meta +++ b/Assets/InGame/ButtonSkin/BackBtn.png.meta @@ -96,6 +96,19 @@ TextureImporter: ignorePlatformSupport: 0 androidETC2FallbackOverride: 0 forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 spriteSheet: serializedVersion: 2 sprites: @@ -134,7 +147,8 @@ TextureImporter: secondaryTextures: [] spriteCustomMetadata: entries: [] - nameFileIdTable: {} + nameFileIdTable: + BackBtn_0: -2614270113051161491 mipmapLimitGroupName: pSDRemoveMatte: 0 userData: diff --git a/Assets/InGame/ButtonSkin/ExitButton.png.meta b/Assets/InGame/ButtonSkin/ExitButton.png.meta index aa5179d..e1e7756 100644 --- a/Assets/InGame/ButtonSkin/ExitButton.png.meta +++ b/Assets/InGame/ButtonSkin/ExitButton.png.meta @@ -96,6 +96,19 @@ TextureImporter: ignorePlatformSupport: 0 androidETC2FallbackOverride: 0 forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 spriteSheet: serializedVersion: 2 sprites: @@ -134,7 +147,8 @@ TextureImporter: secondaryTextures: [] spriteCustomMetadata: entries: [] - nameFileIdTable: {} + nameFileIdTable: + ExitButton_0: -8811806715494619191 mipmapLimitGroupName: pSDRemoveMatte: 0 userData: diff --git a/Assets/InGame/ButtonSkin/LevelStatsBtn.png.meta b/Assets/InGame/ButtonSkin/LevelStatsBtn.png.meta index e60fe49..27bb5d2 100644 --- a/Assets/InGame/ButtonSkin/LevelStatsBtn.png.meta +++ b/Assets/InGame/ButtonSkin/LevelStatsBtn.png.meta @@ -96,6 +96,19 @@ TextureImporter: ignorePlatformSupport: 0 androidETC2FallbackOverride: 0 forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 spriteSheet: serializedVersion: 2 sprites: @@ -134,7 +147,8 @@ TextureImporter: secondaryTextures: [] spriteCustomMetadata: entries: [] - nameFileIdTable: {} + nameFileIdTable: + LevelStatsBtn_0: 6693083200273925831 mipmapLimitGroupName: pSDRemoveMatte: 0 userData: diff --git a/Assets/InGame/ButtonSkin/PlayButton.png.meta b/Assets/InGame/ButtonSkin/PlayButton.png.meta index b57abd9..5c562b3 100644 --- a/Assets/InGame/ButtonSkin/PlayButton.png.meta +++ b/Assets/InGame/ButtonSkin/PlayButton.png.meta @@ -96,6 +96,19 @@ TextureImporter: ignorePlatformSupport: 0 androidETC2FallbackOverride: 0 forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 spriteSheet: serializedVersion: 2 sprites: @@ -134,7 +147,8 @@ TextureImporter: secondaryTextures: [] spriteCustomMetadata: entries: [] - nameFileIdTable: {} + nameFileIdTable: + PlayButton_0: -1958676783162264248 mipmapLimitGroupName: pSDRemoveMatte: 0 userData: diff --git a/Assets/InGame/ButtonSkin/SettingsButton.png.meta b/Assets/InGame/ButtonSkin/SettingsButton.png.meta index 3f24563..7b0c2fa 100644 --- a/Assets/InGame/ButtonSkin/SettingsButton.png.meta +++ b/Assets/InGame/ButtonSkin/SettingsButton.png.meta @@ -96,6 +96,19 @@ TextureImporter: ignorePlatformSupport: 0 androidETC2FallbackOverride: 0 forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 spriteSheet: serializedVersion: 2 sprites: @@ -134,7 +147,8 @@ TextureImporter: secondaryTextures: [] spriteCustomMetadata: entries: [] - nameFileIdTable: {} + nameFileIdTable: + SettingsButton_0: -1655109142887154325 mipmapLimitGroupName: pSDRemoveMatte: 0 userData: diff --git a/Assets/MainMenu.cs b/Assets/MainMenu.cs index 2a3e88f..8e1ab8c 100644 --- a/Assets/MainMenu.cs +++ b/Assets/MainMenu.cs @@ -5,7 +5,7 @@ public class MainMenu : MonoBehaviour { public void LaunchGame() { - SceneManager.LoadSceneAsync(1); + SceneManager.LoadSceneAsync("SelectLevelScene"); } public void OpenSettings() diff --git a/Assets/Scenes/LevelScene.unity b/Assets/Scenes/LevelScene.unity index 512e562..5883d85 100644 --- a/Assets/Scenes/LevelScene.unity +++ b/Assets/Scenes/LevelScene.unity @@ -5395,8 +5395,8 @@ Transform: m_GameObject: {fileID: 1235900592} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.13, y: -6.04, z: 0} - m_LocalScale: {x: 150, y: 1, z: 1} + m_LocalPosition: {x: 353.61, y: -5.69, z: 0} + m_LocalScale: {x: 150, y: 0.8581, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} @@ -5999,6 +5999,140 @@ BoxCollider2D: m_AutoTiling: 0 m_Size: {x: 5.121194, y: 1.4569769} m_EdgeRadius: 0 +--- !u!1 &2062107675 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2062107678} + - component: {fileID: 2062107677} + - component: {fileID: 2062107676} + m_Layer: 0 + m_Name: WinnerWall + m_TagString: Win + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!61 &2062107676 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2062107675} + m_Enabled: 1 + serializedVersion: 3 + m_Density: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_ForceSendLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ForceReceiveLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ContactCaptureLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_CallbackLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_CompositeOperation: 0 + m_CompositeOrder: 0 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 5.12, y: 5.12} + newSize: {x: 5.12, y: 5.12} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + m_Size: {x: 5.12, y: 5.12} + m_EdgeRadius: 0 +--- !u!212 &2062107677 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2062107675} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + 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: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: -2257217325195158302, guid: a192a62ef32304b4182909c80a175f39, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &2062107678 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2062107675} + serializedVersion: 2 + m_LocalRotation: {x: -0.027460787, y: -0.027460786, z: 0.70657337, w: 0.70657337} + m_LocalPosition: {x: 40.61, y: -5.69, z: 0} + m_LocalScale: {x: 10, y: 0.8581, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: -4.451, z: 90} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 @@ -6008,3 +6142,4 @@ SceneRoots: - {fileID: 1235900594} - {fileID: 1009490389} - {fileID: 1783527216} + - {fileID: 2062107678} diff --git a/Assets/Scenes/SelectLevelScene.unity b/Assets/Scenes/SelectLevelScene.unity index 4700aa4..78d0d32 100644 --- a/Assets/Scenes/SelectLevelScene.unity +++ b/Assets/Scenes/SelectLevelScene.unity @@ -1173,9 +1173,7 @@ RectTransform: - {fileID: 1364527282} - {fileID: 1094616662} - {fileID: 91128434} - - {fileID: 1501206177} - {fileID: 1174740938} - - {fileID: 1700570036} m_Father: {fileID: 1170341695} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -1757,156 +1755,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1364527281} m_CullTransparentMesh: 1 ---- !u!1 &1501206176 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1501206177} - - component: {fileID: 1501206179} - - component: {fileID: 1501206178} - m_Layer: 5 - m_Name: NormalModeProgressBar - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &1501206177 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1501206176} - 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: [] - m_Father: {fileID: 1153106989} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -72.5} - m_SizeDelta: {x: -500, y: -355} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &1501206178 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1501206176} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 0.392} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} - m_Type: 1 - 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!222 &1501206179 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1501206176} - m_CullTransparentMesh: 1 ---- !u!1 &1700570035 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1700570036} - - component: {fileID: 1700570038} - - component: {fileID: 1700570037} - m_Layer: 5 - m_Name: PraticeModeProgressBar - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &1700570036 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1700570035} - 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: [] - m_Father: {fileID: 1153106989} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -127.5} - m_SizeDelta: {x: -500, y: -355} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &1700570037 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1700570035} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 0.392} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} - m_Type: 1 - 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!222 &1700570038 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1700570035} - m_CullTransparentMesh: 1 --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/PlayerScript.cs b/Assets/Scripts/PlayerScript.cs index 89888f1..c3b4881 100644 --- a/Assets/Scripts/PlayerScript.cs +++ b/Assets/Scripts/PlayerScript.cs @@ -93,6 +93,11 @@ public class PlayerScript : MonoBehaviour { SceneManager.LoadScene(SceneManager.GetActiveScene().name); } + + if (collision.gameObject.tag == "Win") + { + SceneManager.LoadScene("HomeScene"); + } } public void OnCollisionExit2D(Collision2D collision) diff --git a/Assets/SelectLevelMenu.cs b/Assets/SelectLevelMenu.cs index c04cdb8..4fe7942 100644 --- a/Assets/SelectLevelMenu.cs +++ b/Assets/SelectLevelMenu.cs @@ -5,12 +5,12 @@ public class SelectLevelMenu : MonoBehaviour { public void PlayLevel() { - SceneManager.LoadSceneAsync(2); + SceneManager.LoadScene("LevelScene"); } public void BackBtn() { - SceneManager.LoadSceneAsync(0); + SceneManager.LoadScene("HomeScene"); } public void LastLevel() diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index ae9ce44..fbd2fcc 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -5,6 +5,7 @@ TagManager: serializedVersion: 3 tags: - Kill + - Win layers: - Default - TransparentFX