From 2af19baccd46e481e607a81e60d560fc713a7a9c Mon Sep 17 00:00:00 2001 From: Glence Date: Thu, 2 Mar 2023 00:02:18 +0800 Subject: [PATCH] Added the transition back to the scene --- Assets/Scenes/Level1.shade | 44 +++++++++++++++++-- Assets/Scenes/Level2.shade | 44 +++++++++++++++++-- .../Gameplay/Player/SC_PlayerController.cs | 2 + Assets/Scripts/Gameplay/SC_GameManager.cs | 9 +++- .../Gameplay/SC_PreviewLevel.cs.shmeta | 3 ++ Assets/Scripts/UI/SC_StealFoodPopUp.cs | 8 +++- 6 files changed, 99 insertions(+), 11 deletions(-) create mode 100644 Assets/Scripts/Gameplay/SC_PreviewLevel.cs.shmeta diff --git a/Assets/Scenes/Level1.shade b/Assets/Scenes/Level1.shade index be64bcdc..1dd30cd9 100644 --- a/Assets/Scenes/Level1.shade +++ b/Assets/Scenes/Level1.shade @@ -4901,7 +4901,7 @@ Components: Transform Component: Translate: {x: -8, y: 1.142977, z: -4} - Rotate: {x: -0, y: 0, z: -0} + Rotate: {x: -0, y: 1.57079637, z: -0} Scale: {x: 0.999999881, y: 1, z: 0.999999881} IsActive: true Renderable Component: @@ -4981,7 +4981,7 @@ Components: Transform Component: Translate: {x: 0, y: -2.98023224e-08, z: 4.76837158e-07} - Rotate: {x: 0, y: 6.28318548, z: 2.23517329e-08} + Rotate: {x: 0, y: 4.71238899, z: 2.23517329e-08} Scale: {x: 1, y: 1, z: 1} IsActive: true Camera Component: @@ -5070,7 +5070,7 @@ IsActive: true Scripts: ~ - EID: 464 - Name: Canvas + Name: StealFoodCanvas IsActive: true NumberOfChildren: 1 Components: @@ -5282,4 +5282,40 @@ Hovered: false Clicked: false IsActive: true - Scripts: ~ \ No newline at end of file + Scripts: ~ +- EID: 450 + Name: TransitionCanvas + IsActive: true + NumberOfChildren: 1 + Components: + Canvas Component: + Canvas Width: 1920 + Canvas Height: 1080 + Scale by canvas width: false + IsActive: true + Scripts: ~ +- EID: 65982 + Name: Transition + IsActive: true + NumberOfChildren: 0 + Components: + Transform Component: + Translate: {x: 0, y: 0, z: 0.100000001} + Rotate: {x: 0, y: 0, z: 0} + Scale: {x: 1920, y: 1080, z: 1} + IsActive: true + Renderable Component: + Mesh: 141771688 + Material: 120016136 + IsActive: true + UI Component: + Canvas ID: 450 + Hovered: false + Clicked: false + IsActive: true + Scripts: + - Type: SHADE_Scripting.UI.SceneFadeInOut + Enabled: true + alphaValue: 1 + fadeInTime: 0.300000012 + fadeOutTime: 0.300000012 \ No newline at end of file diff --git a/Assets/Scenes/Level2.shade b/Assets/Scenes/Level2.shade index 89ca90ff..2ed42280 100644 --- a/Assets/Scenes/Level2.shade +++ b/Assets/Scenes/Level2.shade @@ -3530,8 +3530,8 @@ NumberOfChildren: 5 Components: Transform Component: - Translate: {x: 2.35245037, y: 0.38365531, z: 7.10571432} - Rotate: {x: 0, y: 0, z: 0} + Translate: {x: 2.35245037, y: 0.0613552481, z: 7.10571432} + Rotate: {x: -0, y: 3.14159274, z: -0} Scale: {x: 0.999999881, y: 1, z: 0.999999881} IsActive: true Renderable Component: @@ -3611,7 +3611,7 @@ Components: Transform Component: Translate: {x: 0, y: -5.96046448e-08, z: 0} - Rotate: {x: 0, y: 6.28318548, z: 2.23517329e-08} + Rotate: {x: 0, y: 3.14159274, z: 2.23517329e-08} Scale: {x: 1, y: 1, z: 1} IsActive: true Camera Component: @@ -14569,4 +14569,40 @@ stayDuration: 1 rotationAmt: 1800 scaleAmtX: 538 - scaleAmtY: 377 \ No newline at end of file + scaleAmtY: 377 +- EID: 548 + Name: TransitionCanvas + IsActive: true + NumberOfChildren: 1 + Components: + Canvas Component: + Canvas Width: 1920 + Canvas Height: 1080 + Scale by canvas width: false + IsActive: true + Scripts: ~ +- EID: 549 + Name: Transition + IsActive: true + NumberOfChildren: 0 + Components: + Transform Component: + Translate: {x: 0, y: 0, z: 0.100000001} + Rotate: {x: 0, y: 0, z: 0} + Scale: {x: 1920, y: 1080, z: 1} + IsActive: true + Renderable Component: + Mesh: 141771688 + Material: 120016136 + IsActive: true + UI Component: + Canvas ID: 548 + Hovered: false + Clicked: false + IsActive: true + Scripts: + - Type: SHADE_Scripting.UI.SceneFadeInOut + Enabled: true + alphaValue: 1 + fadeInTime: 0.5 + fadeOutTime: 0.5 \ No newline at end of file diff --git a/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs b/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs index e27e6b5e..9781f466 100644 --- a/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs +++ b/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs @@ -344,6 +344,7 @@ public class PlayerController : Script private void Rotation() { + tranform.LocalEulerAngles = new Vector3(0.0f, tranform.LocalEulerAngles.y, 0.0f); if (isMoveKeyPress && tranform && !isAiming) { Quaternion currentRotation = tranform.LocalRotation; @@ -356,6 +357,7 @@ public class PlayerController : Script Quaternion targetRotation = Quaternion.Euler(0.0f, SHADE.Math.DegreesToRadians(camArm.Yaw + 180.0f), 0.0f); tranform.LocalRotation = Quaternion.Slerp(currentRotation, targetRotation, rotationFactorPerFrame * (float)Time.FixedDeltaTime); } + } private void Gravity() diff --git a/Assets/Scripts/Gameplay/SC_GameManager.cs b/Assets/Scripts/Gameplay/SC_GameManager.cs index 2aa6271b..78773ed3 100644 --- a/Assets/Scripts/Gameplay/SC_GameManager.cs +++ b/Assets/Scripts/Gameplay/SC_GameManager.cs @@ -72,6 +72,11 @@ public class GameManager : Script goingToWin = false; goingToLose = false; + + if (scoreText) + scoreText.GetComponent().Text = $"Score: {Score}"; + if (timeText) + timeText.GetComponent().Text = $"Time Left: {timer.ToString("0")}"; } protected override void start() @@ -91,7 +96,7 @@ public class GameManager : Script protected override void update() { - if (GamePause) + if (GamePause || stealFoodPopUp) { return; } @@ -102,7 +107,7 @@ public class GameManager : Script if(scoreText) scoreText.GetComponent().Text = $"Score: {Score}"; if(timeText) - timeText.GetComponent().Text = $"Time Left: {timer.ToString("0.00")}"; + timeText.GetComponent().Text = $"Time Left: {timer.ToString("0")}"; if (itemScored) { diff --git a/Assets/Scripts/Gameplay/SC_PreviewLevel.cs.shmeta b/Assets/Scripts/Gameplay/SC_PreviewLevel.cs.shmeta new file mode 100644 index 00000000..6eb37f9a --- /dev/null +++ b/Assets/Scripts/Gameplay/SC_PreviewLevel.cs.shmeta @@ -0,0 +1,3 @@ +Name: SC_PreviewLevel +ID: 155897609 +Type: 9 diff --git a/Assets/Scripts/UI/SC_StealFoodPopUp.cs b/Assets/Scripts/UI/SC_StealFoodPopUp.cs index 60bec589..f7f8b75a 100644 --- a/Assets/Scripts/UI/SC_StealFoodPopUp.cs +++ b/Assets/Scripts/UI/SC_StealFoodPopUp.cs @@ -51,6 +51,13 @@ namespace SHADE_Scripting.UI //538x377 protected override void update() { + if (!SceneFadeInOut.Instance.FadeOutFinished()) + { + rot.Reset(); + scaleX.Reset(); + scaleY.Reset(); + return; + } if (!popInDone) { @@ -84,7 +91,6 @@ namespace SHADE_Scripting.UI } } - } }