diff --git a/Assets/Scripts/Cheat/DebugController.cs b/Assets/Scripts/Cheat/DebugController.cs index c76651fd14f5a1ed3a115f33177f425f361258d7..35f82c3d9d1294166c13d3a24035a6b191af0769 100644 --- a/Assets/Scripts/Cheat/DebugController.cs +++ b/Assets/Scripts/Cheat/DebugController.cs @@ -14,6 +14,12 @@ public class DebugController : MonoBehaviour public static DebugCommand ONE_HIT_KILL; public static DebugCommand MOTHERLODE; public static DebugCommand DOUBLE_SPEED; + + public static DebugCommand DEACTIVATE_NO_DAMAGE; + public static DebugCommand DEACTIVATE_ONE_HIT_KILL; + public static DebugCommand DEACTIVATE_MOTHERLODE; + public static DebugCommand DEACTIVATE_DOUBLE_SPEED; + public static DebugCommand PET_FULL_HP; public static DebugCommand KILL_PET; public static DebugCommand ORB; @@ -56,7 +62,7 @@ public class DebugController : MonoBehaviour ONE_HIT_KILL = new DebugCommand("one_hit_kill", "Player Can Kill Enemy with One Hit.", "one_hit_kill", () => { - FindObjectOfType<PlayerShooting>().CheatOneHitKill(); + FindObjectOfType<PlayerAttribute>().CheatOneHitKill(); }); MOTHERLODE = new DebugCommand("motherlode", "Gain Resources.", "motherlode", () => @@ -69,6 +75,26 @@ public class DebugController : MonoBehaviour FindObjectOfType<PlayerMovement>().CheatDoubleSpeed(); }); + DEACTIVATE_NO_DAMAGE = new DebugCommand("deactivate_no_damage", "Player Has No Damage.", "deactivate_no_damage", () => + { + FindObjectOfType<PlayerHealth>().DeactivateCheatNoDamage(); + }); + + DEACTIVATE_ONE_HIT_KILL = new DebugCommand("deactivate_one_hit_kill", "Player Can Kill Enemy with One Hit.", "deactivate_one_hit_kill", () => + { + FindObjectOfType<PlayerAttribute>().DeactivateCheatOneHitKill(); + }); + + DEACTIVATE_MOTHERLODE = new DebugCommand("deactivate_motherlode", "Gain Resources.", "deactivate_motherlode", () => + { + FindObjectOfType<PlayerGold>().DeactivateCheatMotherlode(); + }); + + DEACTIVATE_DOUBLE_SPEED = new DebugCommand("deactivate_double_speed", "Double Player Speed.", "deactivate_double_speed", () => + { + FindObjectOfType<PlayerMovement>().DeactivateCheatDoubleSpeed(); + }); + PET_FULL_HP = new DebugCommand("pet_full_hp", "Restore Pet's Health to Full.", "pet_full_hp", () => { FindObjectOfType<PetHeatlh>().CheatPetFullHP(); @@ -76,12 +102,12 @@ public class DebugController : MonoBehaviour KILL_PET = new DebugCommand("kill_pet", "Kill Pet.", "kill_pet", () => { - FindObjectOfType<PlayerShooting>().CheatKillPet(); + FindObjectOfType<PlayerAttribute>().CheatKillPet(); }); ORB = new DebugCommand("orb", "Spawn Orb.", "orb", () => { - FindObjectOfType<PlayerShooting>().CheatOrb(); + FindObjectOfType<PlayerHealth>().CheatOrb(); }); SKIP_LEVEL = new DebugCommand("skip_level", "Skip Current Level.", "skip_level", () => diff --git a/Assets/Scripts/Player/PlayerAttribute.cs b/Assets/Scripts/Player/PlayerAttribute.cs new file mode 100644 index 0000000000000000000000000000000000000000..7656ac2fd787e295a0be6b78523f062104723311 --- /dev/null +++ b/Assets/Scripts/Player/PlayerAttribute.cs @@ -0,0 +1,43 @@ +using Nightmare; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class PlayerAttribute : MonoBehaviour +{ + public bool isOneHitKill = false; + void Awake() + { + + } + + void Update() + { + + } + + public void CheatOneHitKill() + { + isOneHitKill = true; + FindObjectOfType<GunAttack>().damagePerShot = 9999; + FindObjectOfType<ShotgunAttack>().damagePerBullet = 9999; + FindObjectOfType<SwordAttack>().damagePerSlash = 9999; + } + + public void DeactivateCheatOneHitKill() + { + isOneHitKill = false; + FindObjectOfType<GunAttack>().damagePerShot = 20; + FindObjectOfType<ShotgunAttack>().damagePerBullet = 5; + FindObjectOfType<SwordAttack>().damagePerSlash = 40; + } + + + + public void CheatKillPet() + { + // Bunuh pet + // Misalnya: + // petHealth.TakeDamage(petHealth.CurrentHealth()); + } +} diff --git a/Assets/Scripts/Player/PlayerAttribute.cs.meta b/Assets/Scripts/Player/PlayerAttribute.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..a44ded5ba727638f1c28d25faf40e8f68d0237e0 --- /dev/null +++ b/Assets/Scripts/Player/PlayerAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a3e213799f809834ea32edb63b9f8361 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Player/PlayerGold.cs b/Assets/Scripts/Player/PlayerGold.cs index 8b759ed2a362595159a09e856019a365fea7c841..a89c1083dadb42a70caf76d55bb18093a81d9d17 100644 --- a/Assets/Scripts/Player/PlayerGold.cs +++ b/Assets/Scripts/Player/PlayerGold.cs @@ -14,6 +14,14 @@ namespace Nightmare currentGold = startingGold; } + private void Update() + { + if (isMotherlode) + { + currentGold = int.MaxValue; + } + } + public void AddGold(int amount) { currentGold += amount; @@ -34,6 +42,12 @@ namespace Nightmare isMotherlode = true; currentGold = int.MaxValue; } + + public void DeactivateCheatMotherlode() + { + isMotherlode = false; + currentGold = 100; + } } } diff --git a/Assets/Scripts/Player/PlayerHealth.cs b/Assets/Scripts/Player/PlayerHealth.cs index c62ef587b2551b265d6518be55a28844e7b92438..2350fa03b556a7f2f335bfadd970dfd38f3e46d8 100644 --- a/Assets/Scripts/Player/PlayerHealth.cs +++ b/Assets/Scripts/Player/PlayerHealth.cs @@ -125,5 +125,15 @@ namespace Nightmare { godMode = false; } + + public void CheatOrb() + { + currentHealth += 20; + + if (currentHealth > 100) + { + currentHealth = 100; + } + } } } \ No newline at end of file diff --git a/Assets/Scripts/Player/PlayerMovement.cs b/Assets/Scripts/Player/PlayerMovement.cs index 4633e11a7b46fedc2f7e5c7faa1615f2230fc671..6721b8deb52f0f2b98888a6932aa908f675db00d 100644 --- a/Assets/Scripts/Player/PlayerMovement.cs +++ b/Assets/Scripts/Player/PlayerMovement.cs @@ -124,5 +124,11 @@ namespace Nightmare isDoubleSpeed = true; speed = speed * 2; } + + public void DeactivateCheatDoubleSpeed() + { + isDoubleSpeed = false; + speed = speed / 2; + } } } \ No newline at end of file