// OnStateMachineEnter is called when entering a state machine via its Entry Node override public void OnStateMachineEnter(Animator animator, int stateMachinePathHash) { _animator = animator; if (_workerActions == null) { _workerActions = animator.GetComponent <WorkerActionsComponent>(); } if (animator.GetBool("Action In Preparation")) { if (animator.GetInteger("Current Action Id") != 0) { _triggerAction = true; } else { animator.SetBool("Action In Preparation", false); } } if (!animator.GetBool("Action In Preparation")) { _workerActions.MakeActionDelay(StartRandom); } }
// 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) { _animator = animator; animator.SetBool("Action In Preparation", false); animator.SetBool("In Action", true); animator.SetBool("At Target", false); if (workerActions == null) { workerActions = animator.GetComponent <WorkerActionsComponent>(); } workerActions?.StartCountdownActionDuration(FinishAction); }
// 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) { WorkerActionsComponent workerActions = animator.GetComponent <WorkerActionsComponent>(); _path = workerActions.CurrentActionPath; Debug.Log("PATH = " + _path.Count); _targetRotation = workerActions.TargetRotation; if (_path.Count > 0) { CalculateCurrentToTargetRotation(animator, _path[0]); } _initialized = true; }
private void Initialize(int pathHash) { if (workerActions == null) { workerActions = _animator.GetComponent <WorkerActionsComponent>(); } if (_action == WorkerAction.None && workerActions != null) { _action = workerActions.GetActionByStateHash(pathHash); } if (workerPathfinder == null) { workerPathfinder = _animator.GetComponent <WorkerActionsPaths>(); } if (workerDurations == null) { workerDurations = _animator.GetComponent <WorkerActionsDurations>(); } }