/// <summary>
 /// Called on the enter of the locomotion animation.
 /// </summary>
 /// <remarks>Should only be called by a locomotion StateMachineBehaviour</remarks>
 public void OnLocomotionAnimationEnter(GroundMovementConfig movementConfig)
 {
     if (animatorState == AnimatorState.Falling)
     {
         animatorState = AnimatorState.Locomotion;
     }
     else if (animatorState == AnimatorState.Jump)
     {
         animatorState = AnimatorState.JumpLanding;
     }
     m_Motor.SetMovementConfig(movementConfig);
 }
Пример #2
0
        /// <summary>
        /// Initializes the motor
        /// </summary>
        /// <param name="brain"><see cref="ThirdPersonBrain"/> calling the initialization</param>
        public void Init(ThirdPersonBrain brain)
        {
            m_MainCamera                     = Camera.main;
            m_GameObject                     = brain.gameObject;
            m_Transform                      = brain.transform;
            m_ThirdPersonBrain               = brain;
            m_CharacterInput                 = brain.thirdPersonInput;
            m_ControllerAdapter              = brain.controllerAdapter;
            m_Animator                       = m_GameObject.GetComponent <Animator>();
            m_AverageForwardVelocity         = new SlidingAverage(m_Configuration.jumpGroundVelocityWindowSize);
            m_ExplorationAverageForwardInput = new SlidingAverage(m_Configuration.forwardInputWindowSize);
            m_StrafeAverageForwardInput      = new SlidingAverage(m_Configuration.strafeInputWindowSize);
            m_StrafeAverageLateralInput      = new SlidingAverage(m_Configuration.strafeInputWindowSize);
            m_PreviousInputs                 = new SizedQueue <Vector2>(m_Configuration.bufferSizeInput);
            movementMode                     = ThirdPersonMotorMovementMode.Exploration;
            m_CurrentGroundMovementConfig    = m_Configuration.defaultGroundMovementConfig;

            EndStrafe();
        }
Пример #3
0
 /// <summary>
 /// Sets the current <see cref="GroundMovementConfig"/> to be used.
 /// </summary>
 /// <param name="config">Config to use.</param>
 public void SetMovementConfig(GroundMovementConfig config)
 {
     m_CurrentGroundMovementConfig = !m_Configuration.alwaysUseDefaultConfig && config != null
                         ? config : m_Configuration.defaultGroundMovementConfig;
 }