void FixedUpdate()
        {
            float dt = Time.deltaTime;

            if (CharacterActor == null)
            {
                return;
            }

            if (!CharacterActor.enabled)
            {
                return;
            }

            if (currentState == null)
            {
                return;
            }


            bool changeOfState = CheckForTransitions();

            // Reset the transitions
            transitionsQueue.Clear();

            if (changeOfState)
            {
                previousState.ExitBehaviour(dt, currentState);

                if (CanCurrentStateOverrideAnimatorController)
                {
                    Animator.runtimeAnimatorController = currentState.RuntimeAnimatorController;
                }



                currentState.EnterBehaviour(dt, previousState);
            }

            currentState.PreUpdateBehaviour(dt);
            currentState.UpdateBehaviour(dt);
            currentState.PostUpdateBehaviour(dt);
        }
Exemple #2
0
        public override void UpdateBehaviour(float dt)
        {
            if (!characterActor.enabled)
            {
                return;
            }

            if (currentState == null)
            {
                return;
            }


            bool changeOfState = CheckForTransitions();

            // Reset the transitions
            transitionsQueue.Clear();

            if (changeOfState)
            {
                previousState.ExitBehaviour(dt, currentState);

                if (Animator != null)
                {
                    if (currentState.RuntimeAnimatorController != null)
                    {
                        Animator.runtimeAnimatorController = currentState.RuntimeAnimatorController;
                    }
                }


                currentState.EnterBehaviour(dt, previousState);
            }

            currentState.PreUpdateBehaviour(dt);
            currentState.UpdateBehaviour(dt);
            currentState.PostUpdateBehaviour(dt);
        }