From 803e186bcc03627863c8d473f8c9b1737ed8c536 Mon Sep 17 00:00:00 2001 From: Sewmina Date: Tue, 3 Feb 2026 02:35:27 +0530 Subject: [PATCH] rev, v0.3 --- Assets/Prefabs/StatCanvas.prefab | 254 ++++++++++++++++++ Assets/Prefabs/StatCanvas.prefab.meta | 7 + Assets/Resources.meta | 8 + Assets/Resources/PerformanceTestRunInfo.json | 1 + .../PerformanceTestRunInfo.json.meta | 7 + .../Resources/PerformanceTestRunSettings.json | 1 + .../PerformanceTestRunSettings.json.meta | 7 + Assets/Scenes/MainMenu.unity | 98 +++++++ Assets/Scenes/Proto.unity | 146 +++++++++- Assets/Scripts/Ball.cs | 14 + Assets/Scripts/GameManager.cs | 54 +++- Assets/Scripts/Goal.cs | 15 ++ Assets/Scripts/Puck.cs | 19 +- Assets/Scripts/StatCanvas.cs | 26 ++ Assets/Scripts/StatCanvas.cs.meta | 2 + ProjectSettings/ProjectSettings.asset | 5 +- 16 files changed, 647 insertions(+), 17 deletions(-) create mode 100644 Assets/Prefabs/StatCanvas.prefab create mode 100644 Assets/Prefabs/StatCanvas.prefab.meta create mode 100644 Assets/Resources.meta create mode 100644 Assets/Resources/PerformanceTestRunInfo.json create mode 100644 Assets/Resources/PerformanceTestRunInfo.json.meta create mode 100644 Assets/Resources/PerformanceTestRunSettings.json create mode 100644 Assets/Resources/PerformanceTestRunSettings.json.meta create mode 100644 Assets/Scripts/StatCanvas.cs create mode 100644 Assets/Scripts/StatCanvas.cs.meta diff --git a/Assets/Prefabs/StatCanvas.prefab b/Assets/Prefabs/StatCanvas.prefab new file mode 100644 index 0000000..4f75798 --- /dev/null +++ b/Assets/Prefabs/StatCanvas.prefab @@ -0,0 +1,254 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &4255535781679041948 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8148443726761504317} + - component: {fileID: 7185748248354233203} + - component: {fileID: 1582340966432493308} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8148443726761504317 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4255535781679041948} + 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: 378226125633811743} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 20.2, y: 0} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0, y: 0} +--- !u!222 &7185748248354233203 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4255535781679041948} + m_CullTransparentMesh: 1 +--- !u!114 &1582340966432493308 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4255535781679041948} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: v 1.0 + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &6529101514838995975 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 378226125633811743} + - component: {fileID: 9021764628489125324} + - component: {fileID: 2365839604947463070} + - component: {fileID: 6979407368816897676} + - component: {fileID: 611180778396270180} + m_Layer: 5 + m_Name: StatCanvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &378226125633811743 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6529101514838995975} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 8148443726761504317} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!223 &9021764628489125324 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6529101514838995975} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_AdditionalShaderChannelsFlag: 25 + m_UpdateRectTransformForStandalone: 0 + m_SortingLayerID: 0 + m_SortingOrder: 10 + m_TargetDisplay: 0 +--- !u!114 &2365839604947463070 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6529101514838995975} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 1280, y: 1920} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0.5 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!114 &6979407368816897676 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6529101514838995975} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &611180778396270180 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6529101514838995975} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a49b5cb62dd2545408364e077bdf3a0a, type: 3} + m_Name: + m_EditorClassIdentifier: + txtVersion: {fileID: 1582340966432493308} diff --git a/Assets/Prefabs/StatCanvas.prefab.meta b/Assets/Prefabs/StatCanvas.prefab.meta new file mode 100644 index 0000000..55c2cd5 --- /dev/null +++ b/Assets/Prefabs/StatCanvas.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 400992651824baf47abb64c18227c556 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources.meta b/Assets/Resources.meta new file mode 100644 index 0000000..3a0636c --- /dev/null +++ b/Assets/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e616d32bb51bedf49bdcd96c1c17265d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/PerformanceTestRunInfo.json b/Assets/Resources/PerformanceTestRunInfo.json new file mode 100644 index 0000000..9dc2d46 --- /dev/null +++ b/Assets/Resources/PerformanceTestRunInfo.json @@ -0,0 +1 @@ +{"TestSuite":"","Date":0,"Player":{"Development":false,"ScreenWidth":0,"ScreenHeight":0,"ScreenRefreshRate":0,"Fullscreen":false,"Vsync":0,"AntiAliasing":0,"Batchmode":false,"RenderThreadingMode":"MultiThreaded","MtRendering":false,"GraphicsJobs":false,"GpuSkinning":false,"Platform":"","ColorSpace":"","AnisotropicFiltering":"","BlendWeights":"","GraphicsApi":"","ScriptingBackend":"IL2CPP","AndroidTargetSdkVersion":"AndroidApiLevelAuto","AndroidBuildSystem":"Gradle","BuildTarget":"Android","StereoRenderingPath":"MultiPass"},"Hardware":{"OperatingSystem":"","DeviceModel":"","DeviceName":"","ProcessorType":"","ProcessorCount":0,"GraphicsDeviceName":"","SystemMemorySizeMB":0},"Editor":{"Version":"6000.0.59f2","Branch":"6000.0/respin/6000.0.59f1-063c55f2fd0f","Changeset":"ef281c76c3c1","Date":1759317678},"Dependencies":["com.boxqkrtm.ide.cursor@2.0.27","com.unity.collab-proxy@2.11.3","com.unity.feature.2d@2.0.1","com.unity.ide.rider@3.0.38","com.unity.ide.visualstudio@2.0.23","com.unity.inputsystem@1.14.2","com.unity.multiplayer.center@1.0.0","com.unity.render-pipelines.universal@17.0.4","com.unity.test-framework@1.6.0","com.unity.timeline@1.8.9","com.unity.ugui@2.0.0","com.unity.visualscripting@1.9.7","com.unity.modules.accessibility@1.0.0","com.unity.modules.ai@1.0.0","com.unity.modules.androidjni@1.0.0","com.unity.modules.animation@1.0.0","com.unity.modules.assetbundle@1.0.0","com.unity.modules.audio@1.0.0","com.unity.modules.cloth@1.0.0","com.unity.modules.director@1.0.0","com.unity.modules.imageconversion@1.0.0","com.unity.modules.imgui@1.0.0","com.unity.modules.jsonserialize@1.0.0","com.unity.modules.particlesystem@1.0.0","com.unity.modules.physics@1.0.0","com.unity.modules.physics2d@1.0.0","com.unity.modules.screencapture@1.0.0","com.unity.modules.terrain@1.0.0","com.unity.modules.terrainphysics@1.0.0","com.unity.modules.tilemap@1.0.0","com.unity.modules.ui@1.0.0","com.unity.modules.uielements@1.0.0","com.unity.modules.umbra@1.0.0","com.unity.modules.unityanalytics@1.0.0","com.unity.modules.unitywebrequest@1.0.0","com.unity.modules.unitywebrequestassetbundle@1.0.0","com.unity.modules.unitywebrequestaudio@1.0.0","com.unity.modules.unitywebrequesttexture@1.0.0","com.unity.modules.unitywebrequestwww@1.0.0","com.unity.modules.vehicles@1.0.0","com.unity.modules.video@1.0.0","com.unity.modules.vr@1.0.0","com.unity.modules.wind@1.0.0","com.unity.modules.xr@1.0.0","com.unity.modules.subsystems@1.0.0","com.unity.modules.hierarchycore@1.0.0","com.unity.ext.nunit@2.0.5","com.unity.render-pipelines.core@17.0.4","com.unity.shadergraph@17.0.4","com.unity.render-pipelines.universal-config@17.0.3","com.unity.2d.animation@10.2.1","com.unity.2d.pixel-perfect@5.0.3","com.unity.2d.psdimporter@9.1.0","com.unity.2d.sprite@1.0.0","com.unity.2d.spriteshape@10.0.7","com.unity.2d.tilemap@1.0.0","com.unity.2d.tilemap.extras@4.1.0","com.unity.2d.aseprite@1.1.10","com.unity.searcher@4.9.3","com.unity.burst@1.8.25","com.unity.mathematics@1.3.2","com.unity.collections@2.5.1","com.unity.rendering.light-transport@1.0.1","com.unity.2d.common@9.1.1","com.unity.nuget.mono-cecil@1.11.4","com.unity.test-framework.performance@3.2.0"],"Results":[]} \ No newline at end of file diff --git a/Assets/Resources/PerformanceTestRunInfo.json.meta b/Assets/Resources/PerformanceTestRunInfo.json.meta new file mode 100644 index 0000000..d872e1f --- /dev/null +++ b/Assets/Resources/PerformanceTestRunInfo.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5d0035bef0bb88648b0fb5aeff3487b9 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/PerformanceTestRunSettings.json b/Assets/Resources/PerformanceTestRunSettings.json new file mode 100644 index 0000000..49438ae --- /dev/null +++ b/Assets/Resources/PerformanceTestRunSettings.json @@ -0,0 +1 @@ +{"MeasurementCount":-1} \ No newline at end of file diff --git a/Assets/Resources/PerformanceTestRunSettings.json.meta b/Assets/Resources/PerformanceTestRunSettings.json.meta new file mode 100644 index 0000000..97a3875 --- /dev/null +++ b/Assets/Resources/PerformanceTestRunSettings.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4e8594bd03f396a41a133b945ae68a45 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/MainMenu.unity b/Assets/Scenes/MainMenu.unity index bed1d78..65b8c1b 100644 --- a/Assets/Scenes/MainMenu.unity +++ b/Assets/Scenes/MainMenu.unity @@ -959,6 +959,103 @@ RectTransform: m_CorrespondingSourceObject: {fileID: 1825499016186761123, guid: 9e10565277ea942469a04e8e4a29b8e8, type: 3} m_PrefabInstance: {fileID: 2088688617} m_PrefabAsset: {fileID: 0} +--- !u!1001 &1249562322832555678 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_Pivot.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6529101514838995975, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_Name + value: StatCanvas + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 400992651824baf47abb64c18227c556, type: 3} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 @@ -966,3 +1063,4 @@ SceneRoots: - {fileID: 557304871} - {fileID: 608674245} - {fileID: 1286039539} + - {fileID: 1249562322832555678} diff --git a/Assets/Scenes/Proto.unity b/Assets/Scenes/Proto.unity index f9a70ee..79c0094 100644 --- a/Assets/Scenes/Proto.unity +++ b/Assets/Scenes/Proto.unity @@ -4656,6 +4656,103 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: c919971d56a5c33418c7a76a4744b63c, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1001 &1645690099 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_Pivot.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 378226125633811743, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6529101514838995975, guid: 400992651824baf47abb64c18227c556, type: 3} + propertyPath: m_Name + value: StatCanvas + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 400992651824baf47abb64c18227c556, type: 3} --- !u!1001 &1678056770 PrefabInstance: m_ObjectHideFlags: 0 @@ -4777,9 +4874,51 @@ MonoBehaviour: gameInputPanel: {fileID: 1302593952} ball: {fileID: 2066222788} puckForce: 5000 - puckForceMaxPoint: 0.75 + puckForceCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: -0.005470276 + value: -0.0004272461 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.7199071 + value: 0.0064275246 + inSlope: 0.5143833 + outSlope: 0.5143833 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.11989239 + - serializedVersion: 3 + time: 2.0207062 + value: 0.5944911 + inSlope: 0.296896 + outSlope: 0.296896 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.08967882 + - serializedVersion: 3 + time: 5.0033493 + value: 0.9958832 + inSlope: -0.007253413 + outSlope: -0.007253413 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.09360156 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 ballMoveTime: 5 - puckDragClamp: 3 + puckDragClampMax: 5 + puckDragMinClamp: 0.75 redScore: 0 blueScore: 0 redScoreText: {fileID: 689409415} @@ -4788,6 +4927,8 @@ MonoBehaviour: blueWon: {fileID: 2114154720} redWon: {fileID: 867463508} pucks: [] + curPuckPullForce: 0 + hitCounter: 0 startPosition: {x: 0, y: 0} curPosition: {x: 0, y: 0} --- !u!1 &1716356728 @@ -5988,3 +6129,4 @@ SceneRoots: - {fileID: 107895371} - {fileID: 467609676} - {fileID: 17454385} + - {fileID: 1645690099} diff --git a/Assets/Scripts/Ball.cs b/Assets/Scripts/Ball.cs index a83471a..8cc963f 100644 --- a/Assets/Scripts/Ball.cs +++ b/Assets/Scripts/Ball.cs @@ -41,6 +41,20 @@ public class Ball : MonoBehaviour float velocityMult = 1- Mathf.Clamp01(rb.linearVelocity.magnitude / maxWallStuckVelocity); Debug.Log($"{collision.collider.name} hit ball @ {otherSpeed}, ball speed: {rb.linearVelocity.magnitude}"); + int mult=0; + if(touchingB){ + mult++; + } + if(touchingT){ + mult++; + } + if(touchingL){ + mult++; + } + if(touchingR){ + mult++; + } + velocityMult *= mult; if (touchingR) { rb.AddForce(Vector2.left * otherSpeed *wallStuckFixForce * velocityMult * Time.deltaTime); } diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index b6abbf1..83c6a24 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using TMPro; +using Unity.VisualScripting; public class GameManager : MonoBehaviour { @@ -24,10 +25,10 @@ public class GameManager : MonoBehaviour public EventTrigger gameInputPanel; public Rigidbody2D ball; public float puckForce = 20f; - [Range(0f,1f)] - public float puckForceMaxPoint = 0.75f; + public AnimationCurve puckForceCurve = AnimationCurve.Linear(0,3,1,1); public float ballMoveTime = 3f; - public float puckDragClamp = 5f; + public float puckDragClampMax = 5f; + public float puckDragMinClamp = 1f; public int redScore,blueScore=0; @@ -39,6 +40,8 @@ public class GameManager : MonoBehaviour [Header("Misc")] public List pucks = new List(); + public float curPuckPullForce; + public int hitCounter = 0; public static GameManager instance; void Awake() @@ -118,14 +121,22 @@ public class GameManager : MonoBehaviour Vector2 endPosition = pointerEventData.position; // Vector2 direction = endPosition - startPosition; Vector2 direction = selectedPuck.lineEnd; + + if(direction.magnitude < puckDragMinClamp){ + selectedPuck = null; + OnSelectedPuckChanged?.Invoke(null); + startPosition = Vector2.zero; + return; + } if(coroutinePostLaunch != null){ StopCoroutine(coroutinePostLaunch); } coroutinePostLaunch = StartCoroutine(CoroutinePostLaunch()); - - float force = puckForce * Time.deltaTime; - Debug.Log($"launching puck at {direction}"); + curPuckPullForce = direction.magnitude; + float force = puckForce * Time.deltaTime * puckForceCurve.Evaluate(curPuckPullForce); + Debug.Log($"launching puck at {direction} with {force * -direction} force"); selectedPuck.GetComponent().AddForce(-direction * force, ForceMode2D.Impulse); + hitCounter++; startPosition = Vector2.zero; selectedPuck = null; @@ -138,6 +149,10 @@ public class GameManager : MonoBehaviour { PointerEventData pointerEventData = eventData as PointerEventData; curPosition = pointerEventData.position; + + if(selectedPuck!=null){ + curPuckPullForce = selectedPuck.lineEnd.magnitude; + } } @@ -174,14 +189,25 @@ public class GameManager : MonoBehaviour public void OnGoal(Team team){ freezeInput=true; + if(hitCounter == 1){ + //kickoff goal + Debug.Log("Kickoff goal"); + StartCoroutine(CoroutineOnGoal(team,true));//true = Kickoff goal, reset only the ball + return; + } if(team == Team.Blue){ blueScore++; blueScoreText.text = blueScore.ToString(); + SelectedTeam = Team.Red; }else{ redScore++; redScoreText.text = redScore.ToString(); + SelectedTeam = Team.Blue; } + OnTeamChanged?.Invoke(SelectedTeam); + + if(blueScore >= 3){ gameOverPanel.SetActive(true); @@ -194,11 +220,13 @@ public class GameManager : MonoBehaviour }else{ StartCoroutine(CoroutineOnGoal(team)); } + + hitCounter = 0; } bool freezeInput = false; - IEnumerator CoroutineOnGoal(Team team){ + IEnumerator CoroutineOnGoal(Team team, bool kickoff = false){ if(coroutinePostLaunch!=null){ StopCoroutine(coroutinePostLaunch); } @@ -216,15 +244,17 @@ public class GameManager : MonoBehaviour } - public void Reset() + public void Reset(bool kickoff = false) { - StartCoroutine(CoroutineReset()); + StartCoroutine(CoroutineReset(kickoff)); } - IEnumerator CoroutineReset(){ + IEnumerator CoroutineReset(bool kickoff = false){ float resetDuration = 0.5f; - foreach(Puck puck in pucks){ - puck.Reset(resetDuration); + if(!kickoff){ + foreach(Puck puck in pucks){ + puck.Reset(resetDuration); + } } ball.GetComponent().Reset(resetDuration); diff --git a/Assets/Scripts/Goal.cs b/Assets/Scripts/Goal.cs index 2e488a8..bb7cb69 100644 --- a/Assets/Scripts/Goal.cs +++ b/Assets/Scripts/Goal.cs @@ -10,6 +10,21 @@ public class Goal : MonoBehaviour Ball ball = collision.gameObject.GetComponent(); Debug.Log(ball.name); GameManager.instance.OnGoal(team); + }else if(collision.gameObject.CompareTag("Puck")){ + Debug.Log("Puck goal", gameObject); + Puck puck = collision.gameObject.GetComponent(); + Debug.Log(puck.name); + puck.ScheduleReset(); + } + } + + void OnTriggerExit2D(Collider2D collision) + { + if(collision.gameObject.CompareTag("Puck")){ + Debug.Log("Puck exit goal", gameObject); + Puck puck = collision.gameObject.GetComponent(); + Debug.Log(puck.name); + puck.UnscheduleReset(); } } } diff --git a/Assets/Scripts/Puck.cs b/Assets/Scripts/Puck.cs index 28237e5..8ee4c0d 100644 --- a/Assets/Scripts/Puck.cs +++ b/Assets/Scripts/Puck.cs @@ -59,7 +59,7 @@ public class Puck : MonoBehaviour Vector3 worldEnd = Camera.main.ScreenToWorldPoint(new Vector3(GameManager.instance.curPosition.x, GameManager.instance.curPosition.y, Camera.main.nearClipPlane)); lineEnd = transform.InverseTransformPoint(worldEnd); - float clamp = GameManager.instance.puckDragClamp; + float clamp = GameManager.instance.puckDragClampMax; lineEnd = Vector2.ClampMagnitude(lineEnd, clamp); // Only two points for the line @@ -105,6 +105,23 @@ public class Puck : MonoBehaviour { StartCoroutine(CoroutineReset(duration)); } + Coroutine coroutineScheduleReset; + public void ScheduleReset(float duration = 0.5f){ + coroutineScheduleReset = StartCoroutine(CoroutineScheduleReset(duration)); + } + + public void UnscheduleReset(){ + if(coroutineScheduleReset != null){ + StopCoroutine(coroutineScheduleReset); + } + } + + IEnumerator CoroutineScheduleReset(float duration){ + while(GameManager.isMoving){ + yield return null; + } + Reset(duration); + } IEnumerator CoroutineReset(float duration){ float t=0; diff --git a/Assets/Scripts/StatCanvas.cs b/Assets/Scripts/StatCanvas.cs new file mode 100644 index 0000000..136e1d1 --- /dev/null +++ b/Assets/Scripts/StatCanvas.cs @@ -0,0 +1,26 @@ +using TMPro; +using UnityEngine; +using UnityEngine.Rendering; + +public class StatCanvas : MonoBehaviour +{ + public static StatCanvas instance; + public TMP_Text txtVersion; + void Awake() + { + if(instance!=null){ + Destroy(gameObject); + return; + } + + instance = this; + DontDestroyOnLoad(gameObject); + } + + void Start() + { + txtVersion.text = "v " + Application.version; + } + + +} diff --git a/Assets/Scripts/StatCanvas.cs.meta b/Assets/Scripts/StatCanvas.cs.meta new file mode 100644 index 0000000..864e9e1 --- /dev/null +++ b/Assets/Scripts/StatCanvas.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: a49b5cb62dd2545408364e077bdf3a0a \ No newline at end of file diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index e8616a3..6ade24d 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -141,8 +141,9 @@ PlayerSettings: loadStoreDebugModeEnabled: 0 visionOSBundleVersion: 1.0 tvOSBundleVersion: 1.0 - bundleVersion: 1.0 - preloadedAssets: [] + bundleVersion: 0.3 + preloadedAssets: + - {fileID: -944628639613478452, guid: 2bcd2660ca9b64942af0de543d8d7100, type: 3} metroInputSource: 0 wsaTransparentSwapchain: 0 m_HolographicPauseOnTrackingLoss: 1