You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
547 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine.AI;
public class DieAction : ActionNode
{
public AI_Worker _Worker;
public override IEnumerator Execute()
{
if (_Worker.animator != null)
{
if (_Worker.animator.GetCurrentAnimatorStateInfo(0).IsName("Die") == false)
{
_Worker.animator.CrossFade("Die", 0f);
_Worker.GetComponent<NavMeshAgent>().enabled = false;
}
}
return base.Execute();
}
}