Quantcast
Viewing all articles
Browse latest Browse all 1488

Assigning Waypoints to an instantiated enemy

Hi, I have a 'Boss' that instantiates itself when all enemies are defeated. Here is the JS (attached to each enemy): public static var enemyCount : int = 3; function OnCollisionEnter( collision : Collision ) { if(collision.gameObject.tag == "fireball") { animation.Play("dying"); audio.Play(); yield WaitForSeconds(0.2); GameObject.Destroy ( gameObject ) ; enemyCount -= 1; } if(enemyCount <= 0) { var instance : GameObject = Instantiate(Resources.Load("boss")); } } I also have a C# script that deals with enemies patrolling Waypoints and chasing the player if they wander within a certain distance from the player. This script is also attached to the enemies, as well as the boss himself. However, I cannot assign Waypoints to the boss like I can to the other enemies. From researching I've read you cannot do this to instantiated objects. Is there any way around this? Please let me know if you require me to provide the patrolling/attacking script. Your help would be much appreciated. Many 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>