From 8092cfabce877219f27ca6cefbe7873aaee4e10a Mon Sep 17 00:00:00 2001 From: Salomo309 <109785084+Salomo309@users.noreply.github.com> Date: Fri, 10 May 2024 14:14:07 +0700 Subject: [PATCH] feat: add cheats --- Assets/Scripts/Player/PlayerGold.cs | 3 +++ Assets/Scripts/Player/PlayerHealth.cs | 4 ++-- Assets/Scripts/Player/PlayerMovement.cs | 4 ++-- Assets/Scripts/Player/PlayerShooting.cs | 16 +++++----------- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/Assets/Scripts/Player/PlayerGold.cs b/Assets/Scripts/Player/PlayerGold.cs index ba4b444..8b759ed 100644 --- a/Assets/Scripts/Player/PlayerGold.cs +++ b/Assets/Scripts/Player/PlayerGold.cs @@ -7,6 +7,8 @@ namespace Nightmare public int startingGold = 100; public int currentGold; + public bool isMotherlode = false; + void Awake() { currentGold = startingGold; @@ -29,6 +31,7 @@ namespace Nightmare public void CheatMotherlode() { + isMotherlode = true; currentGold = int.MaxValue; } } diff --git a/Assets/Scripts/Player/PlayerHealth.cs b/Assets/Scripts/Player/PlayerHealth.cs index 3eb82ac..587ffed 100644 --- a/Assets/Scripts/Player/PlayerHealth.cs +++ b/Assets/Scripts/Player/PlayerHealth.cs @@ -60,7 +60,7 @@ namespace Nightmare // ... transition the colour back to clear. damageImage.color = Color.Lerp(damageImage.color, Color.clear, flashSpeed * Time.deltaTime); } - + // Reset the damaged flag. damaged = false; } @@ -116,7 +116,7 @@ namespace Nightmare EventManager.TriggerEvent("GameOver"); } - private void CheatNoDamage() + public void CheatNoDamage() { godMode = true; currentHealth = int.MaxValue; diff --git a/Assets/Scripts/Player/PlayerMovement.cs b/Assets/Scripts/Player/PlayerMovement.cs index 30e91f4..1328542 100644 --- a/Assets/Scripts/Player/PlayerMovement.cs +++ b/Assets/Scripts/Player/PlayerMovement.cs @@ -14,7 +14,7 @@ namespace Nightmare #if !MOBILE_INPUT int floorMask; // A layer mask so that a ray can be cast just at gameobjects on the floor layer. float camRayLength = 100f; // The length of the ray from the camera into the scene. - bool isDoubleSpeed = false; + public bool isDoubleSpeed = false; #endif void Awake () @@ -124,7 +124,7 @@ namespace Nightmare anim.SetBool ("IsWalking", walking); } - private void CheatDoubleSpeed() + public void CheatDoubleSpeed() { isDoubleSpeed = true; speed = speed * 2; diff --git a/Assets/Scripts/Player/PlayerShooting.cs b/Assets/Scripts/Player/PlayerShooting.cs index d5ddc78..40b0743 100644 --- a/Assets/Scripts/Player/PlayerShooting.cs +++ b/Assets/Scripts/Player/PlayerShooting.cs @@ -14,7 +14,7 @@ namespace Nightmare public float grenadeSpeed = 200f; public float grenadeFireDelay = 0.5f; - bool isOneHitKill = false; + public bool isOneHitKill = false; float timer; Ray shootRay = new Ray(); @@ -190,35 +190,29 @@ namespace Nightmare //grenadeClone.Shoot(grenadeSpeed * transform.forward); } - private void CheatOneHitKill() + public void CheatOneHitKill() { isOneHitKill = true; damagePerShot = 9999; } - private void CheatPetFullHP() - { - // Pulihkan kesehatan pet ke penuh - // Misalnya: - // petHealth.RestoreHealth(); - } - private void CheatKillPet() + public void CheatKillPet() { // Bunuh pet // Misalnya: // petHealth.TakeDamage(petHealth.CurrentHealth()); } - private void CheatOrb() + public void CheatOrb() { // Hasilkan orb // Misalnya: // orbSpawner.SpawnOrb(); } - private void CheatSkipLevel() + public void CheatSkipLevel() { // Loncati level saat ini // Misalnya: -- GitLab