temp
This commit is contained in:
1 parent
d1aad440f5
commit
a2acea39dc
4 files changed
+8
-11
No files matched your search
+4
-4
@@ -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)
|
||||
|
||||
+2
-4
@@ -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;
|
||||
}
|
||||
|
||||
+1
-2
@@ -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)
|
||||
{
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user