I am making a shooting game, where I have a countdown as I destroy enemies. I want to implement logic when all the game objects are destroyed within the given time, and the countdown reaches zero.
How do I do that?
Answer
You need to find a way of identifying all objects of interest. Do they have a particular script on them? You simply count them
if(GameObject.FindObjectOfType()==null)
{
// Everything destroyed
}
else
{
// Something survived
}
No comments:
Post a Comment