private void Update() { var frozen = _animator.GetBool(PlayerFSMData.Stat.Frozen) || _mover.CurrentMovingState == MovingState.Dash || _mover.PullDelaying || _weaponSystem.Frozen; SetFrozen(frozen); _input.DelayInput = _animator.GetBool(PlayerFSMData.Stat.DelayInput); _input.BlockInput = _mover.BlockInput || _animator.GetBool(PlayerFSMData.Stat.BlockInput); var moveInput = _state._frozen ? Vector2.zero : _input.GetMovingDirection().normalized; if (moveInput.x != 0) { moveInput = DirectionalHelper.NormalizeHorizonalDirection(moveInput); } _mover.Move(moveInput); if (_state._frozen) { _animator.SetFloat(PlayerFSMData.Stat.XSpeed, 0); _animator.SetFloat(PlayerFSMData.Stat.YSpeed, _mover.Velocity.y); } else { _animator.SetFloat(PlayerFSMData.Stat.XSpeed, moveInput.x); _animator.SetFloat(PlayerFSMData.Stat.YSpeed, _mover.Velocity.y); UpdateFacingDirection(moveInput); } HandleEndurance(); }
Vector2 NormalizeHorizonalDirection(Vector2 direction) { if (direction.x == 0) { return(_state._facingRight ? Vector2.right : Vector2.left); } return(DirectionalHelper.NormalizeHorizonalDirection(direction)); }