public override void Enter()
        {
            base.Enter();

            // _walkCycleLength = 2 * _strideLength.Value;
            _distanceValue    = 0;
            _walkCyclePercent = 0;
            _walkSpeedFactor  = 0;

            _walkCycleLength = 2 * _targetStrideLength.Value;
            _targetStrideLength.Subscribe(() =>
            {
                _walkCycleLength = 2 * _targetStrideLength.Value;
            });

            _animatable.Animancer.States.GetOrCreate(_move);
            // _animatable.Animancer.Layers[BaseLayer].SetMask(_locomotionMask);
            _animatable.Animancer.Layers[BaseLayer].Play(_move, 0.5f, FadeMode.FixedDuration);

            // Init lean
            _leanForward = new SpecificLean(_animatable.Animancer.Playable, _leanBones.Select(b => b.Value));
            // _leanAngle.Subscribe(() =>
            // {
            //     _lean.Angle = _leanAngle.Value;
            // });
            _leanForwardAxis.Subscribe(() =>
            {
                _leanForward.Axis = _leanForwardAxis.Value;
            });
            _leanForward.Axis = _leanForwardAxis.Value;

            _leanSide = new SpecificLean(_animatable.Animancer.Playable, _leanBones.Select(b => b.Value));
            // _leanSideAngle.Subscribe(() =>
            // {
            //     _leanSide.Angle = _leanSideAngle.Value;
            // });
            _leanSideAxis.Subscribe(() =>
            {
                _leanSide.Axis = _leanSideAxis.Value;
            });
            _leanSide.Axis = _leanSideAxis.Value;

            // Init bob
            _bob = new TranslateRoot(_animatable.Animancer.Playable, _bobBones.Select(b => b.Value));
            // _bobAmplitude.Subscribe(() =>
            // {
            //     _bob.Distance = _bobAmplitude.Value;
            // });
            _bobAxis.Subscribe(() =>
            {
                _bob.Axis = _bobAxis.Value;
            });
            _bob.Distance = 0 + _bobConstantOffset.Value;
            _bob.Axis     = _bobAxis.Value;

            // _damping = new Damping(_animatable.Animancer.Playable, _dampingBoneCount.Value, _dampingEndBone.Value);
        }
Beispiel #2
0
        public override void Enter()
        {
            base.Enter();

            _lean = new SpecificLean(_animatable.Animancer.Playable);
            _angle.Subscribe(() =>
            {
                _lean.Angle = _angle.Value;
            });
            _axis.Subscribe(() =>
            {
                _lean.Axis = _axis.Value;
            });
        }