Skip to content
Snippets Groups Projects
Commit 569c604f authored by Rozan Fadhil Al Hafidz's avatar Rozan Fadhil Al Hafidz
Browse files

fix: enemy attack

parent 4cd243d0
No related merge requests found
...@@ -83,14 +83,12 @@ public class EnemyAttack : MonoBehaviour ...@@ -83,14 +83,12 @@ public class EnemyAttack : MonoBehaviour
void Update () 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 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. // ... attack.
// Debug.Log("Initiate attack"); // ! Debug Debug.Log("Initiate attack"); // ! Debug
Attack (); Attack ();
} }
if (animating == true) { if (animating == true) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment