Skip to content
Snippets Groups Projects
Commit 88e815d4 authored by Saul Sayers's avatar Saul Sayers
Browse files
parents b2d526ba 74213939
Branches
Tags
No related merge requests found
...@@ -8,6 +8,8 @@ public class CheatManager : MonoBehaviour ...@@ -8,6 +8,8 @@ public class CheatManager : MonoBehaviour
string[] cheatCodes; string[] cheatCodes;
bool isMotherlodeCheat = false; bool isMotherlodeCheat = false;
PetHealth petHealthScript;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
...@@ -31,41 +33,44 @@ public class CheatManager : MonoBehaviour ...@@ -31,41 +33,44 @@ public class CheatManager : MonoBehaviour
if (Input.GetKeyDown(KeyCode.C)) { if (Input.GetKeyDown(KeyCode.C)) {
Debug.Log("Show Cheat Codes");
NotificationManager.ShowNotification(cheatCodes[Random.Range(0, cheatCodes.Length)], 2.0f); NotificationManager.ShowNotification(cheatCodes[Random.Range(0, cheatCodes.Length)], 2.0f);
} else if (Input.GetKeyDown(KeyCode.RightAlt)) { } else if (Input.GetKeyDown(KeyCode.RightAlt)) {
Debug.Log("No Damage Cheat");
PlayerHealth.noDamageCheat = true; PlayerHealth.noDamageCheat = true;
NotificationManager.ShowNotification("No Damage Cheat is ON", 2.0f); NotificationManager.ShowNotification("No Damage Cheat is ON", 2.0f);
} else if (Input.GetKeyDown(KeyCode.LeftAlt)) { } else if (Input.GetKeyDown(KeyCode.LeftAlt)) {
Debug.Log("1 Hit Kill Cheat");
PlayerShooting.hitKillCheat = true; PlayerShooting.hitKillCheat = true;
NotificationManager.ShowNotification("1 Hit Kill Cheat is ON", 2.0f); NotificationManager.ShowNotification("1 Hit Kill Cheat is ON", 2.0f);
} else if (Input.GetKeyDown(KeyCode.Z)) { } else if (Input.GetKeyDown(KeyCode.Z)) {
Debug.Log("Motherlode Cheat");
isMotherlodeCheat = true; isMotherlodeCheat = true;
GoldManager.gold = 99999; GoldManager.gold = 99999;
NotificationManager.ShowNotification("Motherlode Cheat", 2.0f); NotificationManager.ShowNotification("Motherlode Cheat", 2.0f);
} else if (Input.GetKeyDown(KeyCode.Equals)) { } else if (Input.GetKeyDown(KeyCode.Equals)) {
Debug.Log("x2 Speed Cheat");
PlayerMovement.speed = 12f; PlayerMovement.speed = 12f;
NotificationManager.ShowNotification("x2 Speed Cheat is ON", 2.0f); NotificationManager.ShowNotification("x2 Speed Cheat is ON", 2.0f);
} else if (Input.GetKeyDown(KeyCode.Backslash)) { } else if (Input.GetKeyDown(KeyCode.Backslash)) {
Debug.Log("Full HP Pet Cheat"); PetHealth.isFullHPCheat = true;
NotificationManager.ShowNotification("Full HP Pet Cheat is ON", 2.0f);
} else if (Input.GetKeyDown(KeyCode.P)) { } else if (Input.GetKeyDown(KeyCode.P)) {
GameObject pet = GameObject.FindGameObjectWithTag("Pet");
Debug.Log("Kill Pet Cheat");
if (pet is not null) {
petHealthScript = pet.GetComponent<PetHealth>();
petHealthScript.Death();
NotificationManager.ShowNotification("Kill Pet Cheat is ON, Pet is Dead", 2.0f);
} else {
NotificationManager.ShowNotification("Kill Pet Cheat is ON, but you don't have a pet", 2.0f);
}
} }
} }
......
...@@ -8,6 +8,8 @@ public class PetHealth : MonoBehaviour ...@@ -8,6 +8,8 @@ public class PetHealth : MonoBehaviour
public int currentHealth; public int currentHealth;
public AudioClip deathClip; public AudioClip deathClip;
public static bool isFullHPCheat = false;
Animator anim; Animator anim;
AudioSource petAudio; AudioSource petAudio;
...@@ -38,6 +40,7 @@ public class PetHealth : MonoBehaviour ...@@ -38,6 +40,7 @@ public class PetHealth : MonoBehaviour
if (isDead) if (isDead)
return; return;
if (!isFullHPCheat) {
petAudio.Play (); petAudio.Play ();
currentHealth -= amount; currentHealth -= amount;
...@@ -50,9 +53,10 @@ public class PetHealth : MonoBehaviour ...@@ -50,9 +53,10 @@ public class PetHealth : MonoBehaviour
Death (); Death ();
} }
} }
}
void Death () public void Death ()
{ {
isDead = true; isDead = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment