]> git.lizzy.rs Git - SuperMouseAdventure.git/blobdiff - 2DGame/Assets/Scripts/Gegner/EnemyScript.cs
Komplexeres Physiksystem und Knockback
[SuperMouseAdventure.git] / 2DGame / Assets / Scripts / Gegner / EnemyScript.cs
index f0d2f1f33299605d789185c71cf41bed9a0bc344..e34a8849e2d8a5cbcc3b3f25168fcd74263e16be 100644 (file)
@@ -4,27 +4,21 @@ using UnityEngine;
 
 public class EnemyScript : MonoBehaviour
 {
-    [SerializeField]
-    int enemyHealth;
-
-    // Start is called before the first frame update
-    void Start()
-    {
-        
-    }
+    public int enemyHealth;
+    public int enemyDamage;
 
     // Update is called once per frame
     void Update()
     {
-        if(enemyHealth == 0)
+        if (enemyHealth <= 0)
         {
-            gameObject.SetActive(false);        
+            Destroy(gameObject);
         }
     }
 
     private void OnTriggerEnter2D(Collider2D collision)
     {
-        if(collision.gameObject.CompareTag("Bullet"))
+        if (collision.gameObject.CompareTag("Bullet"))
         {
             enemyHealth--;
             Destroy(collision.gameObject);