コード例 #1
0
        private void Update()
        {
            if (!_mover.IsConstantMoving && _animator.GetBool(BossFSMData.Stat.Retreat))
            {
                _animator.SetBool(BossFSMData.Stat.Retreat, false);
            }

            _state._frozen    = _animator.GetBool(BossFSMData.Stat.Frozen);
            _input.DelayInput = _animator.GetBool(BossFSMData.Stat.DelayInput);
            _input.BlockInput = _animator.GetBool(BossFSMData.Stat.BlockInput);

            var rawMoveInput = _input.GetMovingDirection();
            var aimInput     = _state._frozen ? Vector2.zero : _input.GetAimingDirection().normalized;
            var moveInput    = _state._frozen ? Vector2.zero : _input.GetMovingDirection().normalized;

            UpdateMovingMode(aimInput, rawMoveInput);
            UpdateFacingDirection(aimInput);
            UpdateStates();

            if (moveInput.x != 0)
            {
                moveInput = NormalizeHorizonalDirection(moveInput);
            }
            _mover.Move(moveInput);

            if (_state._frozen)
            {
                _animator.SetFloat(BossFSMData.Stat.XSpeed, 0);
            }
            else
            {
                _animator.SetFloat(BossFSMData.Stat.XSpeed, moveInput.x);
            }
        }
コード例 #2
0
        private void Update()
        {
            if (dying)
            {
                return;
            }
            _input.BlockInput = _animator.GetBool("BlockInput");
            _state._frozen    = _animator.GetBool("BlockInput");

            var moveInput = _state._frozen ? Vector2.zero : _input.GetMovingDirection();

            _mover.Move(moveInput);
            _animator.SetFloat("XSpeed", moveInput.x);

            var aimInput = _state._frozen ? Vector2.zero : _input.GetAimingDirection();

            if (aimInput.x != 0)
            {
                _animator.FlipX     = aimInput.x > 0;
                _state._facingRight = aimInput.x > 0;
            }

            var backward = _state._facingRight != aimInput.x > 0;

            _animator.SetBool("Backward", backward);
        }