// OnStateEnter is called before OnStateEnter is called on any state inside this state machine override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (animatorFSM == null) { animatorFSM = animator.GetComponent <AnimatorFSM>(); } switch (animatorFSM.GetRobotState()) { case AnimatorFSM.RobotStates.Idle: animator.SetTrigger(animator_IdleTrigger); break; case AnimatorFSM.RobotStates.Patrol: animator.SetTrigger(animator_PatrolTrigger); break; case AnimatorFSM.RobotStates.Chase: animator.SetTrigger(animator_ChaseTrigger); break; case AnimatorFSM.RobotStates.Attack: animator.SetTrigger(animator_AttackTrigger); break; } }
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()); }