Добавление задержки для прыжков + секретный переход на юнити 6.3

This commit is contained in:
MrTorex committed 2025-12-04 23:43:15 +03:00
1 parent 6732aef384
commit f6e8131d22
14 files changed
+532 -860

No files matched your search

@@ -5,11 +5,14 @@ namespace Code.Configs
[CreateAssetMenu(fileName = "CharacterConfig", menuName = "Config/CharacterConfig")]
public class CharacterConfig : ScriptableObject
{
public float
public float
maxStableMoveSpeed = 12f,
stableMovementSharpness = 15f,
orientationSharpness = 10f,
jumpSpeed = 10f;
orientationSharpness = 10f;
public float
jumpSpeed = 10f,
jumpCooldown = 0.4f;
public float
dashSpeed = 20f,
@@ -188,6 +188,9 @@ namespace Code.Gameplay.Character.Controller.Abilities
public void PerformWallJump(CharacterInputs inputs, Quaternion cameraRotation)
{
if (!IsWallRunning || !_motor) return;
if (_motor.CharacterController is not CustomCharacterController controller || !controller.CanJump)
return;
IsWallRunning = false;
@@ -214,10 +217,8 @@ namespace Code.Gameplay.Character.Controller.Abilities
_motor.SetPosition(_motor.TransientPosition + wallAway * 0.07f);
if (_motor.CharacterController is CustomCharacterController controller)
{
controller.BlockAbilities(0.12f);
}
controller.TriggerJump();
controller.BlockAbilities(0.12f);
}
}
}
@@ -39,6 +39,11 @@ namespace Code.Gameplay.Character.Controller
private Vector3 _currentFollowPointLocalPosition;
private bool _wasSlidingLastFrame;
private float _jumpCooldownTimer;
private float _jumpCooldownDuration => _characterConfig.jumpCooldown;
public bool CanJump => !isAbilitiesBlocked && _jumpCooldownTimer <= 0f;
// Подсистемы
private CharacterInputHandler _inputHandler;
private DashMechanic _dashMechanic;
@@ -158,7 +163,16 @@ namespace Code.Gameplay.Character.Controller
_inputHandler.ProcessInputs(ref inputs, motor);
// Передаём запрос прыжка
_groundMovement.RequestJump(inputs.JumpPressed);
var jumpInput = inputs.JumpPressed;
if (jumpInput && CanJump)
{
_groundMovement.RequestJump(true);
}
else
{
_groundMovement.RequestJump(false);
}
}
public void UpdateRotation(ref Quaternion currentRotation, float deltaTime)
@@ -363,6 +377,11 @@ namespace Code.Gameplay.Character.Controller
_currentColliderCenter = _capsuleCollider ? _capsuleCollider.center : _originalColliderCenter;
_currentFollowPointLocalPosition = _cameraFollowPoint ? _cameraFollowPoint.localPosition : _originalFollowPointLocalPosition;
}
public void TriggerJump()
{
_jumpCooldownTimer = _jumpCooldownDuration;
}
public void BeforeCharacterUpdate(float deltaTime)
{
@@ -380,6 +399,9 @@ namespace Code.Gameplay.Character.Controller
{
UpdateSlideTransition(deltaTime);
_jumpCooldownTimer -= deltaTime;
if (_jumpCooldownTimer < 0f) _jumpCooldownTimer = 0f;
_wallLeanMechanic.Update(
_wallRunningMechanic.IsWallRunning,
_wallRunningMechanic.GetWallNormal(),
@@ -76,8 +76,13 @@ namespace Code.Gameplay.Character.Controller.Movement
if (JumpRequested)
{
currentVelocity += motor.CharacterUp * _jumpSpeed - Vector3.Project(currentVelocity, motor.CharacterUp);
JumpRequested = false; // Сброс сразу после применения
JumpRequested = false;
motor.ForceUnground();
if (motor.CharacterController is CustomCharacterController controller)
{
controller.TriggerJump();
}
}
}
}