Exemple #1
0
        /// <summary>
        /// This is called at Update() and sets each of the animators parameters to their corresponding State values
        /// </summary>
        protected virtual void UpdateAnimators()
        {
            if ((UseDefaultMecanim) && (_animator != null))
            {
                MMAnimatorExtensions.UpdateAnimatorBool(_animator, _groundedAnimationParameter, _controller.State.IsGrounded, _animatorParameters);
                MMAnimatorExtensions.UpdateAnimatorBool(_animator, _airborneSpeedAnimationParameter, Airborne, _animatorParameters);
                MMAnimatorExtensions.UpdateAnimatorBool(_animator, _aliveAnimationParameter, (ConditionState.CurrentState != CharacterStates.CharacterConditions.Dead), _animatorParameters);
                MMAnimatorExtensions.UpdateAnimatorFloat(_animator, _xSpeedSpeedAnimationParameter, _controller.Speed.x, _animatorParameters);
                MMAnimatorExtensions.UpdateAnimatorFloat(_animator, _ySpeedSpeedAnimationParameter, _controller.Speed.y, _animatorParameters);
                MMAnimatorExtensions.UpdateAnimatorFloat(_animator, _worldXSpeedSpeedAnimationParameter, _controller.WorldSpeed.x, _animatorParameters);
                MMAnimatorExtensions.UpdateAnimatorFloat(_animator, _worldYSpeedSpeedAnimationParameter, _controller.WorldSpeed.y, _animatorParameters);
                MMAnimatorExtensions.UpdateAnimatorBool(_animator, _collidingLeftAnimationParameter, _controller.State.IsCollidingLeft, _animatorParameters);
                MMAnimatorExtensions.UpdateAnimatorBool(_animator, _collidingRightAnimationParameter, _controller.State.IsCollidingRight, _animatorParameters);
                MMAnimatorExtensions.UpdateAnimatorBool(_animator, _collidingBelowAnimationParameter, _controller.State.IsCollidingBelow, _animatorParameters);
                MMAnimatorExtensions.UpdateAnimatorBool(_animator, _collidingAboveAnimationParameter, _controller.State.IsCollidingAbove, _animatorParameters);
                MMAnimatorExtensions.UpdateAnimatorBool(_animator, _idleSpeedAnimationParameter, (MovementState.CurrentState == CharacterStates.MovementStates.Idle), _animatorParameters);
                MMAnimatorExtensions.UpdateAnimatorBool(_animator, _facingRightAnimationParameter, IsFacingRight, _animatorParameters);

                foreach (CharacterAbility ability in _characterAbilities)
                {
                    if (ability.enabled && ability.AbilityInitialized)
                    {
                        ability.UpdateAnimator();
                    }
                }
            }
        }
Exemple #2
0
 /// <summary>
 /// Sends the current speed and the current value of the Walking state to the animator
 /// </summary>
 public override void UpdateAnimator()
 {
     MMAnimatorExtensions.UpdateAnimatorFloat(_animator, _relativeForwardSpeedAnimationParameter, _relativeSpeed.z, _character._animatorParameters);
     MMAnimatorExtensions.UpdateAnimatorFloat(_animator, _relativeLateralSpeedAnimationParameter, _relativeSpeed.x, _character._animatorParameters);
     MMAnimatorExtensions.UpdateAnimatorFloat(_animator, _relativeForwardSpeedNormalizedAnimationParameter, _relativeSpeedNormalized.z, _character._animatorParameters);
     MMAnimatorExtensions.UpdateAnimatorFloat(_animator, _relativeLateralSpeedNormalizedAnimationParameter, _relativeSpeedNormalized.x, _character._animatorParameters);
 }
Exemple #3
0
        protected virtual void UpdateAnimator(Animator animator, List <int> list)
        {
            MMAnimatorExtensions.UpdateAnimatorBool(animator, _equippedAnimationParameter, true, list);
            MMAnimatorExtensions.UpdateAnimatorBool(animator, _idleAnimationParameter, (WeaponState.CurrentState == Weapon.WeaponStates.WeaponIdle), list);
            MMAnimatorExtensions.UpdateAnimatorBool(animator, _startAnimationParameter, (WeaponState.CurrentState == Weapon.WeaponStates.WeaponStart), list);
            MMAnimatorExtensions.UpdateAnimatorBool(animator, _delayBeforeUseAnimationParameter, (WeaponState.CurrentState == Weapon.WeaponStates.WeaponDelayBeforeUse), list);
            MMAnimatorExtensions.UpdateAnimatorBool(animator, _useAnimationParameter, (WeaponState.CurrentState == Weapon.WeaponStates.WeaponDelayBeforeUse || WeaponState.CurrentState == Weapon.WeaponStates.WeaponUse || WeaponState.CurrentState == Weapon.WeaponStates.WeaponDelayBetweenUses), list);
            MMAnimatorExtensions.UpdateAnimatorBool(animator, _singleUseAnimationParameter, (WeaponState.CurrentState == Weapon.WeaponStates.WeaponUse), list);
            MMAnimatorExtensions.UpdateAnimatorBool(animator, _delayBetweenUsesAnimationParameter, (WeaponState.CurrentState == Weapon.WeaponStates.WeaponDelayBetweenUses), list);
            MMAnimatorExtensions.UpdateAnimatorBool(animator, _stopAnimationParameter, (WeaponState.CurrentState == Weapon.WeaponStates.WeaponStop), list);
            MMAnimatorExtensions.UpdateAnimatorBool(animator, _reloadStartAnimationParameter, (WeaponState.CurrentState == Weapon.WeaponStates.WeaponReloadStart), list);
            MMAnimatorExtensions.UpdateAnimatorBool(animator, _reloadAnimationParameter, (WeaponState.CurrentState == Weapon.WeaponStates.WeaponReload), list);
            MMAnimatorExtensions.UpdateAnimatorBool(animator, _reloadStopAnimationParameter, (WeaponState.CurrentState == Weapon.WeaponStates.WeaponReloadStop), list);

            if (Owner != null)
            {
                MMAnimatorExtensions.UpdateAnimatorBool(animator, _aliveAnimationParameter, (Owner.ConditionState.CurrentState != CharacterStates.CharacterConditions.Dead), list);
            }

            if (_aimableWeapon != null)
            {
                MMAnimatorExtensions.UpdateAnimatorFloat(animator, _weaponAngleAnimationParameter, _aimableWeapon.CurrentAngle, list);
                MMAnimatorExtensions.UpdateAnimatorFloat(animator, _weaponAngleRelativeAnimationParameter, _aimableWeapon.CurrentAngleRelative, list);
            }
            else
            {
                MMAnimatorExtensions.UpdateAnimatorFloat(animator, _weaponAngleAnimationParameter, 0f, list);
                MMAnimatorExtensions.UpdateAnimatorFloat(animator, _weaponAngleRelativeAnimationParameter, 0f, list);
            }

            if (_comboWeapon != null)
            {
                MMAnimatorExtensions.UpdateAnimatorBool(animator, _comboInProgressAnimationParameter, _comboWeapon.ComboInProgress, list);
            }
        }
        /// <summary>
        /// At the end of each cycle, we send our Running status to the character's animator
        /// </summary>
        public override void UpdateAnimator()
        {
            MMAnimatorExtensions.UpdateAnimatorBool(_animator, _dashingAnimationParameter, (_movement.CurrentState == CharacterStates.MovementStates.Dashing), _character._animatorParameters);
            MMAnimatorExtensions.UpdateAnimatorBool(_animator, _dashStartedAnimationParameter, _dashStartedThisFrame, _character._animatorParameters);

            _dashStartedThisFrame = false;
        }
Exemple #5
0
 /// <summary>
 /// On reset ability, we cancel all the changes made
 /// </summary>
 public override void ResetAbility()
 {
     base.ResetAbility();
     StopFlight();
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _flyingAnimationParameter, false, _character._animatorParameters);
     MMAnimatorExtensions.UpdateAnimatorFloat(_animator, _flySpeedAnimationParameter, 0f, _character._animatorParameters);
 }
 /// <summary>
 /// Updates the block's animator.
 /// </summary>
 protected virtual void UpdateAnimator()
 {
     if (_animator != null)
     {
         MMAnimatorExtensions.UpdateAnimatorBool(_animator, "Shaking", (State == FallingPlatformStates.Shaking));
     }
 }
Exemple #7
0
        /// <summary>
        /// This coroutine handles the climb sequence
        /// </summary>
        /// <returns></returns>
        protected virtual IEnumerator Climb()
        {
            // we start to climb
            _movement.ChangeState(CharacterStates.MovementStates.LedgeClimbing);
            MMAnimatorExtensions.UpdateAnimatorBool(_animator, _ledgeClimbingAnimationParameter, true, _character._animatorParameters);
            // we prevent all other input
            _inputManager.InputDetectionActive = false;

            // we wait until the climb animation is complete
            yield return(_climbingAnimationDelay);

            // we restore input and go to idle
            _inputManager.InputDetectionActive = true;
            MMAnimatorExtensions.UpdateAnimatorBool(_animator, _ledgeClimbingAnimationParameter, false, _character._animatorParameters);
            MMAnimatorExtensions.UpdateAnimatorBool(_animator, _idleAnimationParameter, true, _character._animatorParameters);
            _animator.Play(IdleAnimationName);

            // we teleport our character to its new position (this offset is specified on the Ledge object)
            this.transform.position = _ledge.transform.position + _ledge.ClimbOffset;

            // we go back to idle and detach from the ledge
            _movement.ChangeState(CharacterStates.MovementStates.Idle);
            _controller.GravityActive(true);
            DetachFromLedge();
        }
Exemple #8
0
        /// <summary>
        /// This is called at Update() and sets each of the animators parameters to their corresponding State values
        /// </summary>
        protected virtual void UpdateAnimators()
        {
            UpdateAnimationRandomNumber();

            if ((UseDefaultMecanim) && (_animator != null))
            {
                MMAnimatorExtensions.UpdateAnimatorBool(_animator, _groundedAnimationParameter, _controller.Grounded, _animatorParameters);
                MMAnimatorExtensions.UpdateAnimatorBool(_animator, _aliveAnimationParameter, (ConditionState.CurrentState != CharacterStates.CharacterConditions.Dead), _animatorParameters);
                MMAnimatorExtensions.UpdateAnimatorFloat(_animator, _currentSpeedAnimationParameter, _controller.CurrentMovement.magnitude, _animatorParameters);
                MMAnimatorExtensions.UpdateAnimatorFloat(_animator, _xSpeedAnimationParameter, _controller.CurrentMovement.x, _animatorParameters);
                MMAnimatorExtensions.UpdateAnimatorFloat(_animator, _ySpeedAnimationParameter, _controller.CurrentMovement.y, _animatorParameters);
                MMAnimatorExtensions.UpdateAnimatorFloat(_animator, _zSpeedAnimationParameter, _controller.CurrentMovement.z, _animatorParameters);
                MMAnimatorExtensions.UpdateAnimatorBool(_animator, _idleAnimationParameter, (MovementState.CurrentState == CharacterStates.MovementStates.Idle), _animatorParameters);
                MMAnimatorExtensions.UpdateAnimatorFloat(_animator, _randomAnimationParameter, _animatorRandomNumber, _animatorParameters);


                foreach (CharacterAbility ability in _characterAbilities)
                {
                    if (ability.enabled && ability.AbilityInitialized)
                    {
                        ability.UpdateAnimator();
                    }
                }
            }
        }
 /// <summary>
 /// At the end of each cycle, we update our animator parameters with our current state
 /// </summary>
 public override void UpdateAnimator()
 {
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _grabbingAnimationParameter, Grabbing, _character._animatorParameters);
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _throwingAnimationParameter, Throwing, _character._animatorParameters);
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _carryingAnimationParameter, Carrying, _character._animatorParameters);
     MMAnimatorExtensions.UpdateAnimatorInteger(_animator, _carryingIDAnimationParameter, CarryingID, _character._animatorParameters);
 }
Exemple #10
0
        /// <summary>
        /// At the end of each cycle, sends Jumping states to the Character's animator
        /// </summary>
        public override void UpdateAnimator()
        {
            MMAnimatorExtensions.UpdateAnimatorFloat(_animator, _horizontalDirectionAnimationParameter, _horizontalDirection, _character._animatorParameters);
            MMAnimatorExtensions.UpdateAnimatorFloat(_animator, _verticalDirectionAnimationParameter, _verticalDirection, _character._animatorParameters);

            MMAnimatorExtensions.UpdateAnimatorFloat(_animator, _horizontalSpeedAnimationParameter, _newSpeed.x, _character._animatorParameters);
            MMAnimatorExtensions.UpdateAnimatorFloat(_animator, _verticalSpeedAnimationParameter, _newSpeed.y, _character._animatorParameters);
        }
 /// <summary>
 /// On reset ability, we cancel all the changes made
 /// </summary>
 public override void ResetAbility()
 {
     base.ResetAbility();
     Throw();
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _grabbingAnimationParameter, false, _character._animatorParameters);
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _throwingAnimationParameter, false, _character._animatorParameters);
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _carryingAnimationParameter, false, _character._animatorParameters);
 }
Exemple #12
0
 /// <summary>
 /// On reset ability, we cancel all the changes made
 /// </summary>
 public override void ResetAbility()
 {
     base.ResetAbility();
     if (_condition.CurrentState == CharacterStates.CharacterConditions.Normal)
     {
         GetOffTheLadder();
     }
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _ladderClimbingUpAnimationParameter, false, _character._animatorParameters);
 }
Exemple #13
0
 /// <summary>
 /// At the end of the ability's cycle, we send our current crouching and crawling states to the animator
 /// </summary>
 public override void UpdateAnimator()
 {
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _activatingAnimationParameter, _activating, _character._animatorParameters);
     if (_activating && (ButtonActivatedZone != null) && (ButtonActivatedZone.AnimationTriggerParameterName != ""))
     {
         SetTriggerParameter();
     }
     _activating = false;
 }
 /// <summary>
 /// On reset ability, we cancel all the changes made
 /// </summary>
 public override void ResetAbility()
 {
     base.ResetAbility();
     if (_condition.CurrentState == CharacterStates.CharacterConditions.Normal)
     {
         DetachFromLedge();
     }
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _ledgeHangingAnimationParameter, false, _character._animatorParameters);
 }
 /// <summary>
 /// On reset ability, we cancel all the changes made
 /// </summary>
 public override void ResetAbility()
 {
     base.ResetAbility();
     if (_condition.CurrentState == CharacterStates.CharacterConditions.Normal)
     {
         RunStop();
     }
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _runningAnimationParameter, false, _character._animatorParameters);
 }
Exemple #16
0
 /// <summary>
 /// Override this to send parameters to the character's animator. This is called once per cycle, by the Character
 /// class, after Early, normal and Late process().
 /// </summary>
 public override void UpdateAnimator()
 {
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _weaponEquippedAnimationParameter, (CurrentWeapon != null), _character._animatorParameters);
     if (CurrentWeapon == null)
     {
         MMAnimatorExtensions.UpdateAnimatorInteger(_animator, _weaponEquippedIDAnimationParameter, -1, _character._animatorParameters);
         return;
     }
     else
     {
         MMAnimatorExtensions.UpdateAnimatorInteger(_animator, _weaponEquippedIDAnimationParameter, CurrentWeapon.WeaponAnimationID, _character._animatorParameters);
     }
 }
 /// <summary>
 /// When the character dies we stop its jetpack
 /// </summary>
 public override void ResetAbility()
 {
     // if we have a jetpack particle emitter, we turn it off
     if (ParticleEmitter != null)
     {
         ParticleSystem.EmissionModule emissionModule = ParticleEmitter.emission;
         emissionModule.enabled = false;
     }
     StopStartFeedbacks();
     JetpackFuelDurationLeft = JetpackFuelDuration;
     UpdateJetpackBar();
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _jetpackingAnimationParameter, false, _character._animatorParameters);
     _movement?.ChangeState(CharacterStates.MovementStates.Idle);
     _stillFuelLeft = true;
 }
Exemple #18
0
 /// <summary>
 /// Initializes the animator parameters.
 /// </summary>
 protected virtual void InitializeAnimatorParameters()
 {
     if (_animator == null)
     {
         return;
     }
     MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _groundedAnimationParameterName, out _groundedAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
     MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _currentSpeedAnimationParameterName, out _currentSpeedAnimationParameter, AnimatorControllerParameterType.Float, _animatorParameters);
     MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _xSpeedAnimationParameterName, out _xSpeedAnimationParameter, AnimatorControllerParameterType.Float, _animatorParameters);
     MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _ySpeedAnimationParameterName, out _ySpeedAnimationParameter, AnimatorControllerParameterType.Float, _animatorParameters);
     MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _zSpeedAnimationParameterName, out _zSpeedAnimationParameter, AnimatorControllerParameterType.Float, _animatorParameters);
     MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _idleAnimationParameterName, out _idleAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
     MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _aliveAnimationParameterName, out _aliveAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
     MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _randomAnimationParameterName, out _randomAnimationParameter, AnimatorControllerParameterType.Float, _animatorParameters);
 }
Exemple #19
0
    /// <summary>
    /// Initializes the animator parameters.
    /// </summary>
    protected override void InitializeAnimatorParameters()
    {
        if (_animator == null)
        {
            return;
        }

        _animatorParameters = new List <int>();

        MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _groundedAnimationParameterName,
                                                          out _groundedAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
        MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _airborneAnimationParameterName,
                                                          out _airborneSpeedAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
        MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _xSpeedAnimationParameterName,
                                                          out _xSpeedSpeedAnimationParameter, AnimatorControllerParameterType.Float, _animatorParameters);
        MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _ySpeedAnimationParameterName,
                                                          out _ySpeedSpeedAnimationParameter, AnimatorControllerParameterType.Float, _animatorParameters);
        MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _worldXSpeedAnimationParameterName,
                                                          out _worldXSpeedSpeedAnimationParameter, AnimatorControllerParameterType.Float, _animatorParameters);
        MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _worldYSpeedAnimationParameterName,
                                                          out _worldYSpeedSpeedAnimationParameter, AnimatorControllerParameterType.Float, _animatorParameters);
        MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _collidingLeftAnimationParameterName,
                                                          out _collidingLeftAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
        MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _collidingRightAnimationParameterName,
                                                          out _collidingRightAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
        MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _collidingBelowAnimationParameterName,
                                                          out _collidingBelowAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
        MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _collidingAboveAnimationParameterName,
                                                          out _collidingAboveAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
        MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _idleSpeedAnimationParameterName,
                                                          out _idleSpeedAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
        MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _pushWallAnimationParameterName,
                                                          out _pushWallAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
        MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _aliveAnimationParameterName,
                                                          out _aliveAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
        MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _facingRightAnimationParameterName,
                                                          out _facingRightAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
        MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _randomAnimationParameterName,
                                                          out _randomAnimationParameter, AnimatorControllerParameterType.Float, _animatorParameters);
        MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _randomConstantAnimationParameterName,
                                                          out _randomConstantAnimationParameter, AnimatorControllerParameterType.Int, _animatorParameters);

        // we update our constant float animation parameter
        int randomConstant = UnityEngine.Random.Range(0, 1000);

        MMAnimatorExtensions.UpdateAnimatorInteger(_animator, _randomConstantAnimationParameter, randomConstant,
                                                   _animatorParameters);
    }
Exemple #20
0
        protected virtual void AddParametersToAnimator(Animator animator, List <int> list)
        {
            MMAnimatorExtensions.AddAnimatorParameterIfExists(animator, WeaponAngleAnimationParameter, out _weaponAngleAnimationParameter, AnimatorControllerParameterType.Float, list);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(animator, WeaponAngleRelativeAnimationParameter, out _weaponAngleRelativeAnimationParameter, AnimatorControllerParameterType.Float, list);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(animator, IdleAnimationParameter, out _idleAnimationParameter, AnimatorControllerParameterType.Bool, list);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(animator, StartAnimationParameter, out _startAnimationParameter, AnimatorControllerParameterType.Bool, list);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(animator, DelayBeforeUseAnimationParameter, out _delayBeforeUseAnimationParameter, AnimatorControllerParameterType.Bool, list);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(animator, DelayBetweenUsesAnimationParameter, out _delayBetweenUsesAnimationParameter, AnimatorControllerParameterType.Bool, list);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(animator, StopAnimationParameter, out _stopAnimationParameter, AnimatorControllerParameterType.Bool, list);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(animator, ReloadStartAnimationParameter, out _reloadStartAnimationParameter, AnimatorControllerParameterType.Bool, list);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(animator, ReloadStopAnimationParameter, out _reloadStopAnimationParameter, AnimatorControllerParameterType.Bool, list);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(animator, ReloadAnimationParameter, out _reloadAnimationParameter, AnimatorControllerParameterType.Bool, list);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(animator, SingleUseAnimationParameter, out _singleUseAnimationParameter, AnimatorControllerParameterType.Bool, list);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(animator, UseAnimationParameter, out _useAnimationParameter, AnimatorControllerParameterType.Bool, list);

            if (_comboWeapon != null)
            {
                MMAnimatorExtensions.AddAnimatorParameterIfExists(animator, _comboWeapon.ComboInProgressAnimationParameter, out _comboInProgressAnimationParameter, AnimatorControllerParameterType.Bool, list);
            }
        }
Exemple #21
0
        /// <summary>
        /// Initializes the animator parameters.
        /// </summary>
        protected virtual void InitializeAnimatorParameters()
        {
            if (_animator == null)
            {
                return;
            }

            _animatorParameters = new List <int>();

            MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _groundedAnimationParameterName, out _groundedAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _airborneAnimationParameterName, out _airborneSpeedAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _xSpeedAnimationParameterName, out _xSpeedSpeedAnimationParameter, AnimatorControllerParameterType.Float, _animatorParameters);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _ySpeedAnimationParameterName, out _ySpeedSpeedAnimationParameter, AnimatorControllerParameterType.Float, _animatorParameters);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _worldXSpeedAnimationParameterName, out _worldXSpeedSpeedAnimationParameter, AnimatorControllerParameterType.Float, _animatorParameters);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _worldYSpeedAnimationParameterName, out _worldYSpeedSpeedAnimationParameter, AnimatorControllerParameterType.Float, _animatorParameters);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _collidingLeftAnimationParameterName, out _collidingLeftAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _collidingRightAnimationParameterName, out _collidingRightAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _collidingBelowAnimationParameterName, out _collidingBelowAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _collidingAboveAnimationParameterName, out _collidingAboveAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _idleSpeedAnimationParameterName, out _idleSpeedAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _aliveAnimationParameterName, out _aliveAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
            MMAnimatorExtensions.AddAnimatorParameterIfExists(_animator, _facingRightAnimationParameterName, out _facingRightAnimationParameter, AnimatorControllerParameterType.Bool, _animatorParameters);
        }
Exemple #22
0
 /// <summary>
 /// At the end of each cycle, sends Jumping states to the Character's animator
 /// </summary>
 public override void UpdateAnimator()
 {
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _jumpingAnimationParameter, (_movement.CurrentState == CharacterStates.MovementStates.Jumping), _character._animatorParameters);
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _hitTheGroundAnimationParameter, _controller.JustGotGrounded, _character._animatorParameters);
 }
Exemple #23
0
 /// <summary>
 /// At the end of each cycle, we send our character's animator the current fall damage status
 /// </summary>
 public override void UpdateAnimator()
 {
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _crushedAnimationParameter, _crushedThisFrame, _character._animatorParameters);
 }
Exemple #24
0
 /// <summary>
 /// At the end of each cycle, we send our Running status to the character's animator
 /// </summary>
 public override void UpdateAnimator()
 {
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _swimmingAnimationParameter, (_swimDurationLeft > 0f), _character._animatorParameters);
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _swimmingIdleAnimationParameter, (_movement.CurrentState == CharacterStates.MovementStates.SwimmingIdle), _character._animatorParameters);
 }
 /// <summary>
 /// Sends the current speed and the current value of the Walking state to the animator
 /// </summary>
 public override void UpdateAnimator()
 {
     MMAnimatorExtensions.UpdateAnimatorFloat(_animator, _speedAnimationParameter, CurrentSpeed, _character._animatorParameters);
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _walkingAnimationParameter, (_movement.CurrentState == CharacterStates.MovementStates.Walking), _character._animatorParameters);
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _idleAnimationParameter, (_movement.CurrentState == CharacterStates.MovementStates.Idle), _character._animatorParameters);
 }
Exemple #26
0
 /// <summary>
 /// At the end of each cycle, we send our Running status to the character's animator
 /// </summary>
 public override void UpdateAnimator()
 {
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _runningAnimationParameter, (_movement.CurrentState == CharacterStates.MovementStates.Running), _character._animatorParameters);
 }
 /// <summary>
 /// At the end of each cycle, we send our Running status to the character's animator
 /// </summary>
 public override void UpdateAnimator()
 {
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _fallingDownHoleAnimationParameter, (_movement.CurrentState == CharacterStates.MovementStates.FallingDownHole), _character._animatorParameters);
 }
Exemple #28
0
 /// <summary>
 /// Sends the current speed and the current value of the Walking state to the animator
 /// </summary>
 public override void UpdateAnimator()
 {
     MMAnimatorExtensions.UpdateAnimatorFloat(_animator, _speedAnimationParameter, Mathf.Abs(_normalizedHorizontalSpeed), _character._animatorParameters);
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _walkingAnimationParameter, (_movement.CurrentState == CharacterStates.MovementStates.Walking), _character._animatorParameters);
 }
Exemple #29
0
 /// <summary>
 /// On reset ability, we cancel all the changes made
 /// </summary>
 public override void ResetAbility()
 {
     base.ResetAbility();
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _stairsAnimationParameter, false, _character._animatorParameters);
 }
Exemple #30
0
 /// <summary>
 /// At the end of the ability's cycle, we send our current crouching and crawling states to the animator
 /// </summary>
 public override void UpdateAnimator()
 {
     MMAnimatorExtensions.UpdateAnimatorBool(_animator, _stairsAnimationParameter, OnStairs, _character._animatorParameters);
 }