Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonHoangTran committed Apr 1, 2024
2 parents eb113ed + f4e5f42 commit 5a8e806
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Assets/Scenes/RC1 Levels/Jason's Level.unity
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions Assets/Scenes/RC1 Levels/JasonLevel2.unity
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 12 additions & 2 deletions Assets/Scripts/CheatCodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ public class CheatCodes : MonoBehaviour
[SerializeField] private float maxTimeDif = 1;
private List<string> validPatterns = new List<string>() {"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
Expand Down Expand Up @@ -46,7 +48,7 @@ void Update()
addToBuffer("B");
}

checkPatterns();
if(!cheatOnCooldown) checkPatterns();
}

void addToBuffer(string c)
Expand All @@ -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]))
{
Expand All @@ -73,4 +77,10 @@ void QuickDisable()
{
TextActivator.en = false;
}

private IEnumerator CheatCooldown()
{
yield return new WaitForSeconds(maxTimeDif);
cheatOnCooldown = false;
}
}

0 comments on commit 5a8e806

Please sign in to comment.