diff --git a/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Abilities/WallClimbMechanic.cs b/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Abilities/WallClimbMechanic.cs index 627fdd6..99803ae 100644 --- a/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Abilities/WallClimbMechanic.cs +++ b/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Abilities/WallClimbMechanic.cs @@ -19,8 +19,8 @@ namespace Code.Gameplay.Character.Controller.Abilities private bool _hasClimbedThisWallSession; private float _wallClimbCooldownTimer; private readonly float _wallClimbCooldownDuration = 1.5f; - public bool IsWallInteractionAllowed => - !_hasClimbedThisWallSession && _wallClimbCooldownTimer <= 0f; + + public bool IsClimbingActive { get; private set; } // Конструктор механики залазания на стену public WallClimbMechanic(float wallClimbSpeedFactor, float minWallClimbSpeed, float wallDetectionAngleThreshold) @@ -54,8 +54,6 @@ namespace Code.Gameplay.Character.Controller.Abilities // Проекция скорости на направление к стене (отрицательная, если летим в стену) var velocityIntoWall = Vector3.Dot(currentVelocity, -hitNormal); - Debug.Log($"[TryClimbWall] velIntoWall={velocityIntoWall:F2}, min={_minWallClimbSpeed}, climbed={_hasClimbedThisWallSession}, cooldown={_wallClimbCooldownTimer:F2}"); - // Если движемся в стену с достаточной скоростью if (velocityIntoWall > _minWallClimbSpeed) { @@ -69,6 +67,7 @@ namespace Code.Gameplay.Character.Controller.Abilities // Предотвращаем заземление и повторное применение в этом кадре motor.ForceUnground(); _hasClimbedThisWallSession = true; + IsClimbingActive = true; return true; } @@ -79,6 +78,7 @@ namespace Code.Gameplay.Character.Controller.Abilities public void ResetWallClimbSession() { _hasClimbedThisWallSession = false; + IsClimbingActive = false; } public void TickCooldown(float deltaTime) diff --git a/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Abilities/WallLeanMechanic.cs b/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Abilities/WallLeanMechanic.cs index e41c3d8..f1fb02c 100644 --- a/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Abilities/WallLeanMechanic.cs +++ b/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Abilities/WallLeanMechanic.cs @@ -60,12 +60,10 @@ namespace Code.Gameplay.Character.Controller.Abilities { switch (_leanDirection.x) { - case -1 when motor.CharacterRight.x > 0.1f: - case 1 when motor.CharacterRight.x > 0.1f: + case -1 or 1 when motor.CharacterRight.x > 0.1f: _leanSign = -1; break; - case -1 when Mathf.Abs(motor.CharacterRight.x) < 0.1f: - case 1 when Mathf.Abs(motor.CharacterRight.x) < 0.1f: + case -1 or 1 when Mathf.Abs(motor.CharacterRight.x) < 0.1f: _leanDirection = new Vector3(0, 0, -1); break; } diff --git a/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/CustomCharacterController.cs b/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/CustomCharacterController.cs index fa69933..b3c91e4 100644 --- a/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/CustomCharacterController.cs +++ b/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/CustomCharacterController.cs @@ -110,8 +110,7 @@ namespace Code.Gameplay.Character.Controller // Обновление вращения персонажа на основе входных данных public void UpdateRotation(ref Quaternion currentRotation, float deltaTime) { - // ВО ВРЕМЯ СЛАЙДА НЕ ОБНОВЛЯЕМ ВРАЩЕНИЕ - ПЕРСОНАЖ СМОТРИТ ПРЯМО - if (_slideMechanic.IsSliding) return; + if (_slideMechanic.IsSliding || _wallClimbMechanic.IsClimbingActive) return; switch (_currentCameraMode) { diff --git a/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Input/CharacterInputHandler.cs b/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Input/CharacterInputHandler.cs index a4daa1f..e2ac576 100644 --- a/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Input/CharacterInputHandler.cs +++ b/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Input/CharacterInputHandler.cs @@ -113,7 +113,7 @@ namespace Code.Gameplay.Character.Controller.Input var cameraForward = cameraRotation * Vector3.forward; // Проецируем на горизонтальную плоскость - var horizontalForward = Vector3.ProjectOnPlane(cameraForward, motor.CharacterUp).normalized; + var horizontalForward = Vector3.ProjectOnPlane(cameraForward, Vector3.up).normalized; // Если проекция вырождена, используем текущее направление персонажа if (horizontalForward.sqrMagnitude < 0.01f)