]> git.lizzy.rs Git - SuperMouseAdventure.git/blob - 2DGame/Assets/Scripts/Gegner/EnemyScript.cs
Scheren übernehmen Bewegung der Maus
[SuperMouseAdventure.git] / 2DGame / Assets / Scripts / Gegner / EnemyScript.cs
1 using System.Collections;
2 using System.Collections.Generic;
3 using UnityEngine;
4
5 public class EnemyScript : MonoBehaviour
6 {
7     public int enemyHealth;
8     public int enemyDamage;
9
10     // Update is called once per frame
11     void Update()
12     {
13         if (enemyHealth <= 0)
14         {
15             gameObject.SetActive(false);
16         }
17     }
18
19     private void OnTriggerEnter2D(Collider2D collision)
20     {
21         if (collision.gameObject.CompareTag("Bullet"))
22         {
23             enemyHealth--;
24             Destroy(collision.gameObject);
25         }
26     }
27 }