Timeline UI

This commit is contained in:
ThomasCharester committed 2026-10-27 20:47:16 +03:00
1 parent c8626a9806
commit 2697212f05
177 files changed
+52513 -41627

No files matched your search

@@ -2,6 +2,7 @@ using System.Threading;
using Code.Game.Gameplay.Player;
using Code.Infrastructure.Camera;
using Code.Infrastructure.Input;
using Code.OfficeGame.BattleMode.Timeline;
using Cysharp.Threading.Tasks;
using KinematicCharacterController;
using Reflex.Attributes;
@@ -129,7 +130,7 @@ namespace Code.OfficeGame.BattleMode.Actions
private CancellationTokenSource _waitForEnterTokenSource;
private BattleActionDecisionResultCode _decisionResultCode;
public override async UniTask<BattleActionDecisionResultCode> DecideAction()
public override async UniTask<BattleActionDecisionResult> DecideAction()
{
_waitForEnterTokenSource = new CancellationTokenSource();
_decisionResultCode = BattleActionDecisionResultCode.CancelDecision;
@@ -156,11 +157,13 @@ namespace Code.OfficeGame.BattleMode.Actions
Finished = _decisionResultCode != BattleActionDecisionResultCode.Decided;
return _decisionResultCode;
return new() { ResultCode = _decisionResultCode, FrameDuration = _totalFrames};
}
public override BattleActionType ActionType => BattleActionType.Move;
private int _totalFrames;
private void CancelPosition(InputAction.CallbackContext obj)
{
_decisionResultCode = BattleActionDecisionResultCode.CancelDecision;
@@ -180,12 +183,40 @@ namespace Code.OfficeGame.BattleMode.Actions
_corners = _path.corners;
_currentCornerIndex = _corners.Length > 1 ? 1 : 0;
_decisionResultCode = BattleActionDecisionResultCode.Decided;
_totalFrames = CalculatePathFrames(_corners);
}
else
{
_decisionResultCode = BattleActionDecisionResultCode.Deciding;
_totalFrames = 0;
}
else _decisionResultCode = BattleActionDecisionResultCode.Deciding;
_waitForEnterTokenSource?.Cancel();
}
private int CalculatePathFrames(Vector3[] corners)
{
if (corners == null || corners.Length < 2)
return 0;
float totalDistanceXZ = 0f;
for (int i = 1; i < corners.Length; i++)
{
Vector3 segment = corners[i] - corners[i - 1];
segment.y = 0f;
totalDistanceXZ += segment.magnitude;
}
float effectiveDistance = Mathf.Max(0f, totalDistanceXZ - StoppingDistance);
float stepPerFrame = _movementController.MaxStableMoveSpeed * BattleTimeline.TickDelta;
if (stepPerFrame <= 0.0001f)
return 0;
// Округляем вверх, так как последний неполный шаг тоже занимает 1 целый кадр
return Mathf.CeilToInt(effectiveDistance / stepPerFrame);
}
private void SelectPosition(InputAction.CallbackContext input)
{
var position = _cameraStateMachine.Camera.transform.position;