Pracownia-Programowania-Pro.../Assets/Scripts/Enemy Scripts/FindEnemy.cs
Polarjad 1ea616dd60 Added dungeon textures, added scenes, added UI
Enemy balance, added upgrades, added score, added menu
2021-01-25 22:40:51 +01:00

23 lines
503 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FindEnemy : MonoBehaviour
{
private GameObject[] gameObjects;
void Update()
{
gameObjects = GameObject.FindGameObjectsWithTag("Enemy");
Invoke("DestroyDoor", 1.0f);
}
void DestroyDoor()
{
if (gameObjects.Length == 0)
{
Debug.Log("No game objects are tagged with 'Enemy'. Opening door");
Destroy(gameObject);
}
}
}