diff --git a/Assets/Scenes/Level1.shade b/Assets/Scenes/Level1.shade index 9adce522..7f734ac5 100644 --- a/Assets/Scenes/Level1.shade +++ b/Assets/Scenes/Level1.shade @@ -8078,7 +8078,7 @@ - EID: 459 Name: Gameplay Canvas IsActive: true - NumberOfChildren: 3 + NumberOfChildren: 4 Components: Canvas Component: Canvas Width: 1920 @@ -8089,7 +8089,7 @@ - EID: 449 Name: Score Text IsActive: true - NumberOfChildren: 1 + NumberOfChildren: 0 Components: Transform Component: Translate: {x: -800, y: 365, z: 0.600000024} @@ -8107,27 +8107,15 @@ Hovered: false Clicked: false IsActive: true - Scripts: ~ -- EID: 521 - Name: Score BG - IsActive: true - NumberOfChildren: 0 - Components: - Transform Component: - Translate: {x: 0.300000012, y: 0.600000024, z: 0.98999995} - Rotate: {x: 0, y: 0, z: 0} - Scale: {x: 3.45600009, y: 2, z: 1} - IsActive: true - Renderable Component: - Mesh: 141771688 - Material: 127527215 - IsActive: true - UI Component: - Canvas ID: 459 - Hovered: false - Clicked: false - IsActive: true - Scripts: ~ + Scripts: + - Type: SHADE_Scripting.UI.SingleScaleBounce + Enabled: true + durationUp: 0.150000006 + durationDown: 0.300000012 + scaleSize: 1.20000005 + - Type: SHADE_Scripting.UI.ScoreTextDigitPositioning + Enabled: true + offsetPerDigit: 25 - EID: 520 Name: Timer Text IsActive: true @@ -8216,4 +8204,24 @@ Hovered: false Clicked: false IsActive: true + Scripts: ~ +- EID: 521 + Name: Score BG + IsActive: true + NumberOfChildren: 0 + Components: + Transform Component: + Translate: {x: -770, y: 425, z: 59.9999962} + Rotate: {x: 0, y: 0, z: 0} + Scale: {x: 345.600006, y: 200, z: 60} + IsActive: true + Renderable Component: + Mesh: 141771688 + Material: 127527215 + IsActive: true + UI Component: + Canvas ID: 459 + Hovered: false + Clicked: false + IsActive: true Scripts: ~ \ No newline at end of file diff --git a/Assets/Scripts/Gameplay/SC_GameManager.cs b/Assets/Scripts/Gameplay/SC_GameManager.cs index 8398bb06..78414b26 100644 --- a/Assets/Scripts/Gameplay/SC_GameManager.cs +++ b/Assets/Scripts/Gameplay/SC_GameManager.cs @@ -101,6 +101,8 @@ public class GameManager : Script protected override void update() { + + if (GamePause || !stealFoodPopUpDone) { return; @@ -195,6 +197,13 @@ public class GameManager : Script if (SceneFadeInOut.Instance != null) SceneFadeInOut.Instance.CallFadeIn(); } + + if (Input.GetKeyUp(Input.KeyCode.G)) + { + ItemScored(); + Score += 500; + } + } @@ -219,6 +228,13 @@ public class GameManager : Script fx.ShowMultiplier(currMultiplierCombo, maxMultiplierDuration); } + SingleScaleBounce sb = scoreText.GetScript(); + if(sb) + { + sb.ScaleBounceOnce(); + } + + } } diff --git a/Assets/Scripts/UI/SC_ScoreTextDigitPositioning.cs b/Assets/Scripts/UI/SC_ScoreTextDigitPositioning.cs new file mode 100644 index 00000000..0578ce21 --- /dev/null +++ b/Assets/Scripts/UI/SC_ScoreTextDigitPositioning.cs @@ -0,0 +1,42 @@ +using SHADE; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SHADE_Scripting.UI +{ + public class ScoreTextDigitPositioning:Script + { + [NonSerialized] + Vector3 defaultPosition; + + public float offsetPerDigit = 0.0f; + + protected override void awake() + { + Transform trans = GetComponent(); + if(trans) + { + defaultPosition = trans.LocalPosition; + } + } + + protected override void update() + { + TextRenderable text = GetComponent(); + Transform trans = GetComponent(); + if (trans && text) + { + String str = text.Text; + + Vector3 offset = new Vector3((str.Length - 1) * offsetPerDigit, 0.0f, 0.0f); + + trans.LocalPosition = defaultPosition - offset; + } + } + + + } +} diff --git a/Assets/Scripts/UI/SC_ScoreTextDigitPositioning.cs.shmeta b/Assets/Scripts/UI/SC_ScoreTextDigitPositioning.cs.shmeta new file mode 100644 index 00000000..69d30960 --- /dev/null +++ b/Assets/Scripts/UI/SC_ScoreTextDigitPositioning.cs.shmeta @@ -0,0 +1,3 @@ +Name: SC_ScoreTextDigitPositioning +ID: 166859312 +Type: 9 diff --git a/Assets/Scripts/UI/SC_SingleScaleBounce.cs b/Assets/Scripts/UI/SC_SingleScaleBounce.cs new file mode 100644 index 00000000..d0eb4b66 --- /dev/null +++ b/Assets/Scripts/UI/SC_SingleScaleBounce.cs @@ -0,0 +1,73 @@ +using SHADE; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SHADE_Scripting.UI +{ + public class SingleScaleBounce: Script + { + [NonSerialized] + TweenThread thread; + + [NonSerialized] + Vector3 defaultScale; + + public float durationUp = 0.15f; + public float durationDown = 0.3f; + + public float scaleSize = 1.2f; + + [NonSerialized] + private bool scaleUp = false; + + protected override void awake() + { + Transform trans = GetComponent(); + if(trans != null) + { + defaultScale = trans.LocalScale; + } + + } + + protected override void start() + { + thread = TweenManager.CreateTweenThread(0.0f,1.0f,1.0f,EASING_METHOD.EASE_IN_SINE); + } + + + protected override void update() + { + if(scaleUp) + { + if(thread.IsCompleted()) + { + scaleUp = false; + thread.duration = durationDown; + thread.ResetInvert(); + } + } + + Transform trans = GetComponent(); + if(trans != null) + { + trans.LocalScale = defaultScale * thread.GetValue(); + } + + + } + + + public void ScaleBounceOnce() + { + scaleUp = true; + thread.duration = durationUp; + thread.Reset(1.0f, scaleSize); + } + + + } +} diff --git a/Assets/Scripts/UI/SC_SingleScaleBounce.cs.shmeta b/Assets/Scripts/UI/SC_SingleScaleBounce.cs.shmeta new file mode 100644 index 00000000..63bec3f1 --- /dev/null +++ b/Assets/Scripts/UI/SC_SingleScaleBounce.cs.shmeta @@ -0,0 +1,3 @@ +Name: SC_SingleScaleBounce +ID: 151165363 +Type: 9