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

how can i make the enemy kill more players one after the other chasing them ??? thank you

$
0
0
Transform player; // Reference to the player's position. PlayerHealth playerHealth; // Reference to the player's health. EnemyHealth enemyHealth; // Reference to this enemy's health. UnityEngine.AI.NavMeshAgent nav; // Reference to the nav mesh agent. void Awake () { // Set up the references. player = GameObject.FindGameObjectWithTag ("Money").transform; playerHealth = player.GetComponent (); enemyHealth = GetComponent (); nav = GetComponent (); } void Update () { // If the enemy and the player have health left... if(enemyHealth.currentHealth > 0 && playerHealth.currentHealth > 0) { // ... set the destination of the nav mesh agent to the player. nav.SetDestination (player.position); // } // Otherwise... // else // { // ... disable the nav mesh agent. //nav.enabled = false; } }

Viewing all articles
Browse latest Browse all 1488

Trending Articles



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