From 91895dd74439975f7b41cbd6870cb8f6cb15a201 Mon Sep 17 00:00:00 2001
From: fdavin <fransdavin19@gmail.com>
Date: Sat, 15 Apr 2023 09:50:06 +0700
Subject: [PATCH] feat: cheat ohk

---
 Assets/Scripts/Enemy/EnemyHealth.cs     |  7 ++++++-
 Assets/Scripts/Player/PlayerMovement.cs | 13 +++++++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/Assets/Scripts/Enemy/EnemyHealth.cs b/Assets/Scripts/Enemy/EnemyHealth.cs
index 8248bc1..04b7260 100644
--- a/Assets/Scripts/Enemy/EnemyHealth.cs
+++ b/Assets/Scripts/Enemy/EnemyHealth.cs
@@ -18,9 +18,10 @@ public class EnemyHealth : MonoBehaviour, Attackable
 
     public MonsterType monsterType;
     private QuestManager questManager;
-
+    private PlayerMovement player;
     void Awake()
     {
+        player = GameObject.Find("Player").GetComponent<PlayerMovement>();
         //Mendapatkan reference komponen
         anim = GetComponent<Animator>();
         enemyAudio = GetComponent<AudioSource>();
@@ -58,6 +59,10 @@ public class EnemyHealth : MonoBehaviour, Attackable
     // For ranged weapon
     public void TakeDamage(int amount, Vector3 hitPoint)
     {
+        if (player.oneHit)
+        {
+            amount = currentHealth;
+        }
         //Check jika dead
         if (isDead)
             return;
diff --git a/Assets/Scripts/Player/PlayerMovement.cs b/Assets/Scripts/Player/PlayerMovement.cs
index e9bc952..58e695f 100644
--- a/Assets/Scripts/Player/PlayerMovement.cs
+++ b/Assets/Scripts/Player/PlayerMovement.cs
@@ -11,7 +11,7 @@ public class PlayerMovement : MonoBehaviour
     float camRayLength = 100f;
     public int pet = 0;
     public GameObject[] Pets;
-
+    public bool oneHit = false;
     private void Awake()
     {
         if (pet==1){
@@ -48,11 +48,20 @@ public class PlayerMovement : MonoBehaviour
 
     void Update()
     {
-        
+        if (Input.GetKeyDown("k") && !oneHit){
+            Debug.Log("one kill hit mode activated");
+            oneHit = true;
+        }
+        else if (Input.GetKeyDown("k") && oneHit){
+            Debug.Log("one kill hit mode deactivated");
+            oneHit = false;
+        }
         if (Input.GetKeyDown("l") && !DoubleSpeed){
+            Debug.Log("double speed mode activated");
             DoubleSpeed = true;
         }
         else if (Input.GetKeyDown("l") && DoubleSpeed){
+            Debug.Log("double speed mode deactivated");
             DoubleSpeed = false;
         }
         if (DoubleSpeed){
-- 
GitLab