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

I need the Nav Mesh Stop , I need the Animation to Play Javascript

$
0
0
I am almost done setting up my enemy ai . The only thing I need is the nav mesh to stop and play one more animation . I can set the nav mesh to stop in the inspector . When I trying to code it getting an error. I need the attack animation to play ' when it get's near the player. Here is what I got so far : var target : Transform; //the enemy's target var isSeen: boolean = false; function Awake() { GetComponent.().Play("idle"); } function OnTriggerEnter() { GetComponent.().Play("move"); GetComponent.().Stop("idle"); } function OnTriggerExit() { isSeen = true; target = GameObject.FindWithTag("Respawn").transform; //target the player } function OnTriggerStay() { GetComponent.().Play("move"); } function Update () { if(isSeen) { for (var agent in GameObject.FindGameObjectsWithTag("Player")) { agent.GetComponent(NavMeshAgent).SetDestination(target.position); } } } Help would really be appreciated.

Viewing all articles
Browse latest Browse all 1488

Trending Articles



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