Skip to content
Snippets Groups Projects
Commit 080fde2d authored by Bill Clinton's avatar Bill Clinton
Browse files

Merge branch 'feat/cheats-and-orbs' into 'main'

Refactor Motherlode Cheat

See merge request !24
parents b8f90229 15d6657d
Branches
Tags
1 merge request!24Refactor Motherlode Cheat
...@@ -48,7 +48,6 @@ public class CheatManager : MonoBehaviour ...@@ -48,7 +48,6 @@ public class CheatManager : MonoBehaviour
string textInput; string textInput;
public InputField inputField; public InputField inputField;
int prevBalance;
bool[] cheats = new bool[3]; bool[] cheats = new bool[3];
...@@ -165,8 +164,7 @@ public class CheatManager : MonoBehaviour ...@@ -165,8 +164,7 @@ public class CheatManager : MonoBehaviour
private void ActivateMotherlode() private void ActivateMotherlode()
{ {
prevBalance = playerCurrency.balance; playerCurrency.ActivateMotherlode();
playerCurrency.balance = 100000;
hud.OpenPanel("Motherlode Cheat Activated!"); hud.OpenPanel("Motherlode Cheat Activated!");
} }
...@@ -253,7 +251,7 @@ public class CheatManager : MonoBehaviour ...@@ -253,7 +251,7 @@ public class CheatManager : MonoBehaviour
private void ActivateReset() private void ActivateReset()
{ {
playerHealth.SetCheatNoDamage(false); playerHealth.SetCheatNoDamage(false);
playerCurrency.balance = prevBalance; playerCurrency.ResetMotherlode();
playerMovement.ResetSpeed(); playerMovement.ResetSpeed();
playerShooting.ResetPlayerDamage(); playerShooting.ResetPlayerDamage();
......
...@@ -6,6 +6,7 @@ using UnityEngine; ...@@ -6,6 +6,7 @@ using UnityEngine;
public class PlayerCurrency : MonoBehaviour public class PlayerCurrency : MonoBehaviour
{ {
public int balance = 0; public int balance = 0;
int prevBalance;
// Start is called before the first frame update // Start is called before the first frame update
public void add(int nominal) public void add(int nominal)
...@@ -28,4 +29,15 @@ public class PlayerCurrency : MonoBehaviour ...@@ -28,4 +29,15 @@ public class PlayerCurrency : MonoBehaviour
{ {
return balance; return balance;
} }
public void ActivateMotherlode()
{
prevBalance = balance;
balance = 100000;
}
public void ResetMotherlode()
{
balance = prevBalance;
}
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment