From f4e5f422f5333dcc6374578251144d889c35a1c8 Mon Sep 17 00:00:00 2001 From: Caleb Martin Date: Sun, 31 Mar 2024 22:25:31 -0400 Subject: [PATCH] Invuln Toggle Fixed --- Assets/Scenes/RC1 Levels/Jason's Level.unity | 6 +++++- Assets/Scenes/RC1 Levels/JasonLevel2.unity | 4 ++++ Assets/Scripts/CheatCodes.cs | 14 ++++++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Assets/Scenes/RC1 Levels/Jason's Level.unity b/Assets/Scenes/RC1 Levels/Jason's Level.unity index a65454b..37a918b 100644 --- a/Assets/Scenes/RC1 Levels/Jason's Level.unity +++ b/Assets/Scenes/RC1 Levels/Jason's Level.unity @@ -2647,7 +2647,11 @@ PrefabInstance: - target: {fileID: 4330996871911208931, guid: f66a96f16cb6a8141b999ed028b65168, type: 3} propertyPath: m_Camera value: - objectReference: {fileID: 120753315} + objectReference: {fileID: 1655551457} + - target: {fileID: 4330996871911208931, guid: f66a96f16cb6a8141b999ed028b65168, type: 3} + propertyPath: m_SortingOrder + value: 3 + objectReference: {fileID: 0} - target: {fileID: 6032281566785282822, guid: f66a96f16cb6a8141b999ed028b65168, type: 3} propertyPath: m_Pivot.x value: 0 diff --git a/Assets/Scenes/RC1 Levels/JasonLevel2.unity b/Assets/Scenes/RC1 Levels/JasonLevel2.unity index 54829b8..66b42d2 100644 --- a/Assets/Scenes/RC1 Levels/JasonLevel2.unity +++ b/Assets/Scenes/RC1 Levels/JasonLevel2.unity @@ -57010,6 +57010,10 @@ PrefabInstance: - target: {fileID: 4330996871911208931, guid: f66a96f16cb6a8141b999ed028b65168, type: 3} propertyPath: m_Camera value: + objectReference: {fileID: 931603339} + - target: {fileID: 4330996871911208931, guid: f66a96f16cb6a8141b999ed028b65168, type: 3} + propertyPath: m_SortingOrder + value: 3 objectReference: {fileID: 0} - target: {fileID: 6032281566785282822, guid: f66a96f16cb6a8141b999ed028b65168, type: 3} propertyPath: m_Pivot.x diff --git a/Assets/Scripts/CheatCodes.cs b/Assets/Scripts/CheatCodes.cs index 0ee3c8b..c767abb 100644 --- a/Assets/Scripts/CheatCodes.cs +++ b/Assets/Scripts/CheatCodes.cs @@ -9,11 +9,13 @@ public class CheatCodes : MonoBehaviour [SerializeField] private float maxTimeDif = 1; private List validPatterns = new List() {"BBL","BBB"}; private float timeDif; + + private bool cheatOnCooldown; + // Start is called before the first frame update void Start() { timeDif = maxTimeDif; - } // Update is called once per frame @@ -46,7 +48,7 @@ void Update() addToBuffer("B"); } - checkPatterns(); + if(!cheatOnCooldown) checkPatterns(); } void addToBuffer(string c) @@ -60,8 +62,10 @@ void checkPatterns() if (Buffer.EndsWith(validPatterns[0])) { PlayerHealth.invincibility = !PlayerHealth.invincibility; + cheatOnCooldown = true; TextActivator.en = true; Invoke("QuickDisable", 3f); + StartCoroutine(CheatCooldown()); } if (Buffer.EndsWith(validPatterns[1])) { @@ -73,4 +77,10 @@ void QuickDisable() { TextActivator.en = false; } + + private IEnumerator CheatCooldown() + { + yield return new WaitForSeconds(maxTimeDif); + cheatOnCooldown = false; + } }