Убран бег (просто заменён на ходьбу с такой же скоростью), прошлый слайд заменён на дэщ, добавлен новый слайд
This commit is contained in:
1 parent
a1c2c5fd18
commit
77fd9af29d
16 files changed
+247
-182
No files matched your search
+26
-24
@@ -27,6 +27,7 @@ namespace Code.Gameplay.Character.Controller
|
||||
|
||||
// Подсистемы
|
||||
private CharacterInputHandler _inputHandler;
|
||||
private DashMechanic _dashMechanic;
|
||||
private SlideMechanic _slideMechanic;
|
||||
// private WallClimbMechanic _wallClimbMechanic;
|
||||
private WallRunningMechanic _wallRunningMechanic;
|
||||
@@ -50,21 +51,20 @@ namespace Code.Gameplay.Character.Controller
|
||||
{
|
||||
_characterConfig = characterConfig;
|
||||
// Инициализация подсистем с параметрами из конфига
|
||||
_inputHandler = new CharacterInputHandler(
|
||||
_characterConfig.sprintAngleThreshold
|
||||
_inputHandler = new CharacterInputHandler();
|
||||
_dashMechanic = new DashMechanic(
|
||||
_characterConfig.dashSpeed,
|
||||
_characterConfig.dashDuration,
|
||||
_characterConfig.dashCooldown
|
||||
);
|
||||
_slideMechanic = new SlideMechanic(
|
||||
_characterConfig.slideSpeed,
|
||||
_characterConfig.slideDuration,
|
||||
_characterConfig.slideVelocityCurve,
|
||||
_characterConfig.slideMinVelocityThreshold,
|
||||
_characterConfig.slideCooldown
|
||||
);
|
||||
// _wallClimbMechanic = new WallClimbMechanic(
|
||||
// _characterConfig.wallClimbSpeedFactor,
|
||||
// _characterConfig.minWallClimbSpeed,
|
||||
// _characterConfig.wallDetectionAngleThreshold
|
||||
// );
|
||||
_wallRunningMechanic = new WallRunningMechanic();
|
||||
// Настройка параметров WallRunningMechanic (можно вынести в конфиг позже)
|
||||
|
||||
// TODO: WallRunningMechanic (можно вынести в конфиг позже)
|
||||
_wallRunningMechanic.MaxWallRunTime = 1.75f;
|
||||
_wallRunningMechanic.WallRunSpeed = 15.0f;
|
||||
_wallRunningMechanic.WallRunAcceleration = 25.0f;
|
||||
@@ -79,7 +79,6 @@ namespace Code.Gameplay.Character.Controller
|
||||
);
|
||||
_groundMovement = new GroundMovementSystem(
|
||||
_characterConfig.maxStableMoveSpeed,
|
||||
_characterConfig.sprintMoveSpeed,
|
||||
_characterConfig.stableMovementSharpness,
|
||||
_characterConfig.jumpSpeed
|
||||
);
|
||||
@@ -99,17 +98,15 @@ namespace Code.Gameplay.Character.Controller
|
||||
public void SetInputs(ref CharacterInputs inputs)
|
||||
{
|
||||
_lastInputs = inputs;
|
||||
// Обновляем таймеры механик
|
||||
_dashMechanic.TickCooldown(Time.deltaTime);
|
||||
_slideMechanic.TickCooldown(Time.deltaTime);
|
||||
// _wallClimbMechanic.TickCooldown(Time.deltaTime);
|
||||
_wallRunningMechanic.Tick(Time.deltaTime);
|
||||
|
||||
// Если активен слайд - игнорируем весь остальной ввод
|
||||
if (_slideMechanic.IsSliding)
|
||||
if (_dashMechanic.IsDashing || _slideMechanic.IsSliding)
|
||||
{
|
||||
_inputHandler.MoveInputVector = Vector3.zero;
|
||||
_inputHandler.LookInputVector = Vector3.one;
|
||||
_inputHandler.IsSprinting = false;
|
||||
_groundMovement.RequestJump(inputs.JumpPressed);
|
||||
return;
|
||||
}
|
||||
@@ -125,12 +122,12 @@ namespace Code.Gameplay.Character.Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
inputs.SprintPressed = false;
|
||||
inputs.DashPressed = false;
|
||||
inputs.SlidePressed = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Обработка слайда
|
||||
_dashMechanic.RequestDash(inputs.DashPressed);
|
||||
_slideMechanic.RequestSlide(inputs.SlidePressed);
|
||||
|
||||
// Обработка остального ввода
|
||||
@@ -172,16 +169,21 @@ namespace Code.Gameplay.Character.Controller
|
||||
|
||||
public void UpdateVelocity(ref Vector3 currentVelocity, float deltaTime)
|
||||
{
|
||||
if (_dashMechanic.IsDashing && _groundMovement.JumpRequested)
|
||||
_dashMechanic.EndDash();
|
||||
if (_slideMechanic.IsSliding && _groundMovement.JumpRequested)
|
||||
{
|
||||
_slideMechanic.EndSlide();
|
||||
|
||||
if (!_dashMechanic.IsDashing)
|
||||
_dashMechanic.TryStartDash(motor, _currentCameraMode, _inputHandler.FirstPersonCameraRotation, _inputHandler.LookInputVector);
|
||||
else
|
||||
{
|
||||
_dashMechanic.HandleDash(ref currentVelocity, deltaTime, motor);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_slideMechanic.IsSliding)
|
||||
{
|
||||
_slideMechanic.TryStartSlide(motor, _currentCameraMode, _inputHandler.FirstPersonCameraRotation,
|
||||
_inputHandler.LookInputVector);
|
||||
}
|
||||
_slideMechanic.TryStartSlide(motor, _currentCameraMode, _inputHandler.FirstPersonCameraRotation, _inputHandler.LookInputVector);
|
||||
else
|
||||
{
|
||||
_slideMechanic.HandleSlide(ref currentVelocity, deltaTime, motor);
|
||||
@@ -229,10 +231,10 @@ namespace Code.Gameplay.Character.Controller
|
||||
|
||||
public void PostGroundingUpdate(float deltaTime)
|
||||
{
|
||||
if (_dashMechanic.IsDashing && !motor.GroundingStatus.IsStableOnGround)
|
||||
_dashMechanic.EndDash();
|
||||
if (_slideMechanic.IsSliding && !motor.GroundingStatus.IsStableOnGround)
|
||||
{
|
||||
_slideMechanic.EndSlide();
|
||||
}
|
||||
}
|
||||
|
||||
public void AfterCharacterUpdate(float deltaTime)
|
||||
|
||||
Reference in new issue
Block a user