// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        BotUtility botUtility = animator.GetComponentInParent <BotUtility>();
        HealthBox  target     = botUtility.FindClosestHealth();

        if (!botUtility.NavigateTo(target))
        {
            animator.SetTrigger("failed");
        }
    }
Exemple #2
0
    public override TaskStatus OnUpdate()
    {
        BotUtility botUtility = botObject.Value.GetComponent <BotUtility>();

        var target = botUtility.FindClosestHealth();

        if (!botUtility.NavigateTo(target))
        {
            return(TaskStatus.Failure);
        }

        return(TaskStatus.Success);
    }