From 569c604f0e2529c316da2aa7f3dfa139ea8739af Mon Sep 17 00:00:00 2001 From: Rozan Fadhil Al Hafidz <rozanfadhilalahfidz@gmail.com> Date: Sun, 16 Apr 2023 15:55:57 +0700 Subject: [PATCH] fix: enemy attack --- Assets/Scripts/Enemy/EnemyAttack.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/Enemy/EnemyAttack.cs b/Assets/Scripts/Enemy/EnemyAttack.cs index dad81580..4b73ab21 100644 --- a/Assets/Scripts/Enemy/EnemyAttack.cs +++ b/Assets/Scripts/Enemy/EnemyAttack.cs @@ -83,14 +83,12 @@ public class EnemyAttack : MonoBehaviour void Update () { - if (playerInRange || petInRange) { - timer += Time.deltaTime; - } + timer += Time.deltaTime; // If the timer exceeds the time between attacks, the player is in range and this enemy is alive... - if(animating == false && timer >= attackOffset && (playerInRange || petInRange) && enemyHealth.currentHealth > 0) + if (animating == false && timer >= attackOffset && (playerInRange || petInRange) && enemyHealth.currentHealth > 0) { // ... attack. - // Debug.Log("Initiate attack"); // ! Debug + Debug.Log("Initiate attack"); // ! Debug Attack (); } if (animating == true) { -- GitLab