diff --git a/Assets/Scripts/Managers/CheatManager.cs b/Assets/Scripts/Managers/CheatManager.cs index 601b2a6db7ae4b228986008535e54bcfdcb5b572..446fd48bab68414d939cd3a9c8f9e5bb5ff3e8e0 100644 --- a/Assets/Scripts/Managers/CheatManager.cs +++ b/Assets/Scripts/Managers/CheatManager.cs @@ -8,6 +8,8 @@ public class CheatManager : MonoBehaviour string[] cheatCodes; bool isMotherlodeCheat = false; + PetHealth petHealthScript; + // Start is called before the first frame update void Start() { @@ -30,42 +32,45 @@ public class CheatManager : MonoBehaviour } if (Input.GetKeyDown(KeyCode.C)) { - - Debug.Log("Show Cheat Codes"); + NotificationManager.ShowNotification(cheatCodes[Random.Range(0, cheatCodes.Length)], 2.0f); } else if (Input.GetKeyDown(KeyCode.RightAlt)) { - Debug.Log("No Damage Cheat"); PlayerHealth.noDamageCheat = true; NotificationManager.ShowNotification("No Damage Cheat is ON", 2.0f); } else if (Input.GetKeyDown(KeyCode.LeftAlt)) { - Debug.Log("1 Hit Kill Cheat"); PlayerShooting.hitKillCheat = true; NotificationManager.ShowNotification("1 Hit Kill Cheat is ON", 2.0f); } else if (Input.GetKeyDown(KeyCode.Z)) { - Debug.Log("Motherlode Cheat"); isMotherlodeCheat = true; GoldManager.gold = 99999; NotificationManager.ShowNotification("Motherlode Cheat", 2.0f); } else if (Input.GetKeyDown(KeyCode.Equals)) { - Debug.Log("x2 Speed Cheat"); PlayerMovement.speed = 12f; NotificationManager.ShowNotification("x2 Speed Cheat is ON", 2.0f); } 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)) { - - Debug.Log("Kill Pet Cheat"); + GameObject pet = GameObject.FindGameObjectWithTag("Pet"); + + 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); + } } } diff --git a/Assets/Scripts/Pets/PetHealth.cs b/Assets/Scripts/Pets/PetHealth.cs index eb5bbcb38d59c56a48ea5936d8d95afe35781f75..9c0a247e8bd934a303f15cc0761ac60fa48ccbfd 100644 --- a/Assets/Scripts/Pets/PetHealth.cs +++ b/Assets/Scripts/Pets/PetHealth.cs @@ -8,6 +8,8 @@ public class PetHealth : MonoBehaviour public int currentHealth; public AudioClip deathClip; + public static bool isFullHPCheat = false; + Animator anim; AudioSource petAudio; @@ -38,21 +40,23 @@ public class PetHealth : MonoBehaviour if (isDead) return; - petAudio.Play (); + if (!isFullHPCheat) { + petAudio.Play (); - currentHealth -= amount; + currentHealth -= amount; - hitParticles.transform.position = hitPoint; - hitParticles.Play(); + hitParticles.transform.position = hitPoint; + hitParticles.Play(); - if (currentHealth <= 0) - { - Death (); + if (currentHealth <= 0) + { + Death (); + } } } - void Death () + public void Death () { isDead = true;