using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EggsManager : MonoBehaviour
{
public GameObject eggs;
public GameManager _GameManager; // Assign this in the Inspector.
public GameObject GameController;
void Update()
{
eggs = GameObject.FindGameObjectsWithTag("Egg");
bool allEggsDestroyed = true;
foreach (GameObject Egg in eggs)
{
if (Egg != null)
{
allEggsDestroyed = false;
break;
}
}
if (allEggsDestroyed)
{
GameObject GameController = GameObject.FindGameObjectWithTag("GameController");
if (GameController != null)
{
GameController.SetActive(true);
_GameManager = GetComponent<GameManager>();
_GameManager.enabled = true;
}
}
}
}