// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (animatorFSM.GetRobotToPlayerDistance() == AnimatorFSM.Distance.Far)
     {
         animator.SetTrigger(animator_ChaseTrigger);
     }
 }
    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (animatorFSM.GetPlayerVisibility() && !animatorFSM.GetPlayerStatus())
        {
            switch (animatorFSM.GetRobotToPlayerDistance())
            {
            case AnimatorFSM.Distance.Far:
                animator.SetTrigger(animator_ChaseTrigger);
                break;

            case AnimatorFSM.Distance.Near:
                animator.SetTrigger(animator_AttackTrigger);
                break;
            }
        }
    }
Exemplo n.º 3
0
    private void UpdateUI()
    {
        if (fsm.GetRobotState() == AnimatorFSM.RobotStates.Idle)
        {
            StartTimer();
        }
        else
        {
            StopTimer();
        }

        stateText.text = fsm.GetRobotState().ToString();

        distanceDropdown.SetValueWithoutNotify((int)fsm.GetRobotToPlayerDistance());

        idlePauseTimeInputField.text = fsm.GetIdlePauseTime().ToString();

        reachedPatrolPointToggle.SetIsOnWithoutNotify(fsm.GetPatrolReachedPoint());

        canSeePlayerToggle.SetIsOnWithoutNotify(fsm.GetPlayerVisibility());
        playerIsDeadToggle.SetIsOnWithoutNotify(fsm.GetPlayerStatus());
    }