From 3fc43fa92d295a5e4d8f1940f00e3b2ef8112c43 Mon Sep 17 00:00:00 2001 From: Michal Pikulski Date: Thu, 16 Oct 2025 23:59:25 +0200 Subject: [PATCH] Hook up the score display --- .../Prefabs/Managers/CinematicsManager.prefab | 5 ++-- .../Scenes/MiniGames/DivingForPictures.unity | 28 +++++++++---------- Assets/Scripts/UI/DivingGameOverScreen.cs | 15 +++++++++- Assets/Scripts/UI/PauseMenu.cs | 2 +- Assets/Settings/DivingMinigameSettings.asset | 2 +- 5 files changed, 33 insertions(+), 19 deletions(-) diff --git a/Assets/Prefabs/Managers/CinematicsManager.prefab b/Assets/Prefabs/Managers/CinematicsManager.prefab index d4b954bb..5f3829a5 100644 --- a/Assets/Prefabs/Managers/CinematicsManager.prefab +++ b/Assets/Prefabs/Managers/CinematicsManager.prefab @@ -261,6 +261,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: b37e3dc225aa25143af8ab61f827ae8b, type: 3} m_Name: m_EditorClassIdentifier: '::' + finalScoreText: {fileID: 1520153022985003366} --- !u!1 &2350186695477379260 GameObject: m_ObjectHideFlags: 0 @@ -455,7 +456,7 @@ GameObject: - component: {fileID: 2205574065701906917} - component: {fileID: 4125557264992545207} m_Layer: 0 - m_Name: Score + m_Name: ScoreLabel m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -816,7 +817,7 @@ GameObject: - component: {fileID: 8369606923535336432} - component: {fileID: 1520153022985003366} m_Layer: 0 - m_Name: Score (1) + m_Name: ScoreDisplay m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 diff --git a/Assets/Scenes/MiniGames/DivingForPictures.unity b/Assets/Scenes/MiniGames/DivingForPictures.unity index aba522db..d8d5ae94 100644 --- a/Assets/Scenes/MiniGames/DivingForPictures.unity +++ b/Assets/Scenes/MiniGames/DivingForPictures.unity @@ -342,13 +342,13 @@ LineRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_Positions: - - {x: -0.15602553, y: 4.0749445, z: 0} - - {x: -0.1566351, y: 3.9736378, z: 0} + - {x: -0.15602553, y: 4.074945, z: 0} + - {x: -0.1566351, y: 3.9736383, z: 0} - {x: -0.1572447, y: 3.8729858, z: 0} - {x: -0.15785426, y: 3.7729874, z: 0} - - {x: -0.15846384, y: 3.6736438, z: 0} + - {x: -0.15846384, y: 3.6736436, z: 0} - {x: -0.15907341, y: 3.5749543, z: 0} - - {x: -0.15968299, y: 3.4769194, z: 0} + - {x: -0.15968299, y: 3.4769192, z: 0} - {x: -0.16029257, y: 3.3795385, z: 0} - {x: -0.16090216, y: 3.2828126, z: 0} - {x: -0.16151173, y: 3.1867406, z: 0} @@ -915,7 +915,7 @@ Transform: m_GameObject: {fileID: 747976396} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 3.1975174, z: 0} + m_LocalPosition: {x: 0, y: 3.197517, z: 0} m_LocalScale: {x: 0.57574, y: 0.57574, z: 0.57574} m_ConstrainProportionsScale: 0 m_Children: @@ -1369,13 +1369,13 @@ LineRenderer: m_Positions: - {x: -0.15602553, y: 4.074945, z: 0} - {x: -0.11662118, y: 3.8796225, z: 0} - - {x: -0.07721684, y: 3.7057445, z: 0} - - {x: -0.03781248, y: 3.5533106, z: 0} + - {x: -0.07721684, y: 3.7057447, z: 0} + - {x: -0.03781248, y: 3.5533109, z: 0} - {x: 0.0015918687, y: 3.4223216, z: 0} - {x: 0.040996216, y: 3.3127766, z: 0} - - {x: 0.08040057, y: 3.2246757, z: 0} + - {x: 0.08040057, y: 3.224676, z: 0} - {x: 0.11980491, y: 3.1580195, z: 0} - - {x: 0.15920927, y: 3.1128078, z: 0} + - {x: 0.15920927, y: 3.112808, z: 0} - {x: 0.1986136, y: 3.0890403, z: 0} - {x: 0.23801796, y: 3.0867171, z: 0} m_Parameters: @@ -1912,13 +1912,13 @@ LineRenderer: m_Positions: - {x: -0.15602553, y: 4.074945, z: 0} - {x: -0.18956745, y: 3.8764977, z: 0} - - {x: -0.22310936, y: 3.7000232, z: 0} + - {x: -0.22310936, y: 3.7000234, z: 0} - {x: -0.25665125, y: 3.5455205, z: 0} - - {x: -0.29019317, y: 3.4129908, z: 0} + - {x: -0.29019317, y: 3.412991, z: 0} - {x: -0.32373506, y: 3.3024333, z: 0} - - {x: -0.35727698, y: 3.213848, z: 0} - - {x: -0.39081886, y: 3.1472356, z: 0} - - {x: -0.4243608, y: 3.1025953, z: 0} + - {x: -0.35727698, y: 3.2138486, z: 0} + - {x: -0.39081886, y: 3.1472359, z: 0} + - {x: -0.4243608, y: 3.1025958, z: 0} - {x: -0.45790267, y: 3.0799277, z: 0} - {x: -0.4914446, y: 3.0792325, z: 0} m_Parameters: diff --git a/Assets/Scripts/UI/DivingGameOverScreen.cs b/Assets/Scripts/UI/DivingGameOverScreen.cs index 48c74004..8ed733a5 100644 --- a/Assets/Scripts/UI/DivingGameOverScreen.cs +++ b/Assets/Scripts/UI/DivingGameOverScreen.cs @@ -1,16 +1,29 @@ using System; using Core; using UnityEngine; -using UnityEngine.SceneManagement; +using TMPro; +using Minigames.DivingForPictures; public class DivingGameOverScreen : MonoBehaviour { + [SerializeField] + private TextMeshProUGUI finalScoreText; + // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { } + void OnEnable() + { + if (DivingGameManager.Instance != null) + { + int finalScore = DivingGameManager.Instance.PlayerScore; + finalScoreText.text = $"{finalScore}"; + } + } + public async void PlayAgain() { var progress = new Progress(p => Logging.Debug($"Loading progress: {p * 100:F0}%")); diff --git a/Assets/Scripts/UI/PauseMenu.cs b/Assets/Scripts/UI/PauseMenu.cs index 18a206c5..74b194dd 100644 --- a/Assets/Scripts/UI/PauseMenu.cs +++ b/Assets/Scripts/UI/PauseMenu.cs @@ -124,7 +124,7 @@ namespace UI // Clear paused flag and broadcast event _isPaused = false; InputManager.Instance.SetInputMode(InputMode.GameAndUI); - if(resetInput) + if(resetInput) OnGameResumed?.Invoke(); Logging.Debug("[PauseMenu] Game Resumed"); diff --git a/Assets/Settings/DivingMinigameSettings.asset b/Assets/Settings/DivingMinigameSettings.asset index e337c768..18d5890e 100644 --- a/Assets/Settings/DivingMinigameSettings.asset +++ b/Assets/Settings/DivingMinigameSettings.asset @@ -27,7 +27,7 @@ MonoBehaviour: basePoints: 100 depthMultiplier: 10 speedTransitionDuration: 2 - surfacingSpeedFactor: 3 + surfacingSpeedFactor: 6 surfacingSpawnDelay: 5 referenceScreenHeight: 1920 initialTileCount: 3