diff --git a/.erp b/.erp index e1236d6..d57c2fc 100644 --- a/.erp +++ b/.erp @@ -5,7 +5,7 @@ false false true - 1677885521 + 1677887423 2115309888051293429 false \ No newline at end of file diff --git a/Assets/Scenes/GaneScene.unity b/Assets/Scenes/GaneScene.unity index e9fda99..ebdb3b6 100644 --- a/Assets/Scenes/GaneScene.unity +++ b/Assets/Scenes/GaneScene.unity @@ -6779,6 +6779,8 @@ GameObject: m_Component: - component: {fileID: 848339331} - component: {fileID: 848339332} + - component: {fileID: 848339334} + - component: {fileID: 848339333} m_Layer: 5 m_Name: GameStartCountdownUI m_TagString: Untagged @@ -6796,7 +6798,7 @@ RectTransform: 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_ConstrainProportionsScale: 1 m_Children: - {fileID: 665722096} m_Father: {fileID: 1955192637} @@ -6820,6 +6822,39 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: countdownText: {fileID: 665722097} +--- !u!225 &848339333 +CanvasGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 848339330} + m_Enabled: 1 + m_Alpha: 1 + m_Interactable: 1 + m_BlocksRaycasts: 1 + m_IgnoreParentGroups: 0 +--- !u!95 &848339334 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 848339330} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 9d9369ef6465eb747bbfabd3f6b33449, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 --- !u!1 &879897164 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Counters/PlatesCounter.cs b/Assets/Scripts/Counters/PlatesCounter.cs index e13d934..16b978e 100644 --- a/Assets/Scripts/Counters/PlatesCounter.cs +++ b/Assets/Scripts/Counters/PlatesCounter.cs @@ -23,7 +23,7 @@ public class PlatesCounter : BaseCounter { spawnPlateTimer = 0f; - if (platesSpawnedAmount < platesSpawnedMax) + if (GameStateManager.Instace.IsGamePlaying() && platesSpawnedAmount < platesSpawnedMax) { platesSpawnedAmount++; diff --git a/Assets/Scripts/DeliveryManager.cs b/Assets/Scripts/DeliveryManager.cs index edf0e8d..07948e7 100644 --- a/Assets/Scripts/DeliveryManager.cs +++ b/Assets/Scripts/DeliveryManager.cs @@ -34,7 +34,7 @@ public class DeliveryManager : MonoBehaviour { spawnRecipeTimer = spawnRecipeTimerMax; - if (waitingRecipeSOList.Count < waitingRecipesMax) + if (GameStateManager.Instace.IsGamePlaying() && waitingRecipeSOList.Count < waitingRecipesMax) { RecipeSO waitingRecipeSO = recipeListSO.recipeSOList[UnityEngine.Random.Range(0, recipeListSO.recipeSOList.Count)]; diff --git a/Assets/Scripts/SoundManager.cs b/Assets/Scripts/SoundManager.cs index 4504f00..2d3e2ec 100644 --- a/Assets/Scripts/SoundManager.cs +++ b/Assets/Scripts/SoundManager.cs @@ -80,6 +80,11 @@ public class SoundManager : MonoBehaviour PlaySound(audioClipsRefsSO.footstep, position, volume); } + public void PlayCountdown() + { + PlaySound(audioClipsRefsSO.warning, Vector3.zero); + } + public void ChangeVolume() { volume += .1f; diff --git a/Assets/Scripts/UI/GameStartCountdownUI.cs b/Assets/Scripts/UI/GameStartCountdownUI.cs index a043b8f..f099dbd 100644 --- a/Assets/Scripts/UI/GameStartCountdownUI.cs +++ b/Assets/Scripts/UI/GameStartCountdownUI.cs @@ -6,8 +6,18 @@ using UnityEngine; public class GameStartCountdownUI : MonoBehaviour { + private const string NUMBER_POPUP_ANIMATION = "NumberPopup"; + [SerializeField] private TextMeshProUGUI countdownText; + private Animator animator; + private int previousCountdownNumber; + + private void Awake() + { + animator = GetComponent(); + } + private void Start() { GameStateManager.Instace.OnStateChanged += GameStateManager_OnStateChanged; @@ -30,7 +40,18 @@ public class GameStartCountdownUI : MonoBehaviour private void Update() { - countdownText.text = Mathf.Ceil(GameStateManager.Instace.GetCountdownToStartTimer()).ToString(); + int countdownNumber = Mathf.CeilToInt(GameStateManager.Instace.GetCountdownToStartTimer()); + if (countdownNumber != previousCountdownNumber) + { + previousCountdownNumber = countdownNumber; + + animator.SetTrigger(NUMBER_POPUP_ANIMATION); + + countdownText.text = countdownNumber.ToString(); + + SoundManager.Instance.PlayCountdown(); + + } } private void Show()