Beispiel #1
0
        void FixedUpdate()
        {
#if UNITY_EDITOR
            if (isDummy)
            {
                return;
            }
            if (actorController == null)
            {
                return;                 // prevents error spam after editing a script
            }
#endif
            actorPhysics.UpdateInternalStateFromPhysicsResult();
            actorController.FixedUpdateCommands();
            MovementStateType nextState = movementState.FixedUpdateState();
            if (nextState != MovementStateType.NONE)
            {
                if (!movementStateLookup.TryGetValue(nextState, out IMovementState newMovement))
                {
                    Debug.Log(this.name + " could not find movementState for " + nextState.ToString());
                }
                else
                {
                    MovementStateType previousState = movementState.ExitState(nextState);
                    movementState = newMovement;
                    movementState.EnterState(previousState);
                    currentMovementState = nextState;
                }
            }

            actorPhysics.ApplyToPhysics();
        }