Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

How can I have the enemies die when they fall through world?

$
0
0
I have a script where the scene goes to the next scene when all enemies have died. using UnityEngine; using System.Collections; using UnityEngine.SceneManagement; public class Enemy : MonoBehaviour { // Number of enemies alive private static int aliveCounter = 14; void Start() { aliveCounter++; } void OnKilled() { aliveCounter--; if (aliveCounter == 0) SceneManager.LoadScene("Lv.02"); } } But some of them don't die and fall through the game world which means the player can never advance. Rather that go on some massive collider hunt I'd rather just kill those enemies who fall through the world. Any idea what code I can attach to this script to make that happen? Thanks!

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>