/// <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); }
/// <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> /// 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); }
/// <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, _waveHandAnimationParameter, (_movement.CurrentState == CharacterStates.MovementStates.WaveHand), _character._animatorParameters); MMAnimatorExtensions.UpdateAnimatorBool(_animator, _winAnimationParameter, (_movement.CurrentState == CharacterStates.MovementStates.Win), _character._animatorParameters); MMAnimatorExtensions.UpdateAnimatorInteger(_animator, _winIndexAnimationParameter, _randomWinIndex, _character._animatorParameters); }