TimelineImprovements

This commit is contained in:
ThomasCharester committed 2026-11-20 14:28:56 +03:00
1 parent e312131725
commit f927552adc
2211 files changed
+115416 -540944

No files matched your search

@@ -267,16 +267,40 @@ namespace Code.OfficeGame.BattleMode.Timeline
KinematicCharacterSystem.CharacterMotors,
KinematicCharacterSystem.PhysicsMovers);
// ФАЗА 3: Параметры BlendTree ходьбы + шаг аниматоров + RootMotion синхронизация каждый тик
// ФАЗА 3: Параметры ходьбы + шаг аниматоров + чистый дельта-перенос RootMotion
for (int i = 0; i < _entities.Length; i++)
{
var entity = _entities[i];
UpdateAnimatorLocomotionParams(entity);
entity.animator.Update(FixedTickDelta);
if (entity.animator.applyRootMotion)
entity.SyncRootMotionToMotor();
{
Transform animT = entity.animator.transform;
Vector3 savedLocalPos = animT.localPosition;
Quaternion savedLocalRot = animT.localRotation;
Vector3 worldPosBefore = animT.position;
Quaternion worldRotBefore = animT.rotation;
entity.animator.Update(FixedTickDelta);
Vector3 worldDeltaPos = animT.position - worldPosBefore;
Quaternion worldDeltaRot = animT.rotation * Quaternion.Inverse(worldRotBefore);
// Возвращаем модель на её родной локальный оффсет
animT.localPosition = savedLocalPos;
animT.localRotation = savedLocalRot;
var motor = entity.KinematicCharacterMotor;
motor.SetPositionAndRotation(
motor.TransientPosition + worldDeltaPos,
worldDeltaRot * motor.TransientRotation,
bypassInterpolation: true);
motor.BaseVelocity = Vector3.zero;
}
else
{
entity.animator.Update(FixedTickDelta);
}
}
// ФАЗА 4: Единый шаг PhysX и синхронизация костей/хитбоксов ДО проверок
@@ -9,6 +9,7 @@ using Code.Infrastructure.Particles;
using Code.OfficeGame.BattleMode.Actions;
using Code.OfficeGame.BattleMode.Actions.AI;
using Code.OfficeGame.BattleMode.Actions.Deciders;
using Code.OfficeGame.BattleMode.CursorControl;
using Code.OfficeGame.BattleMode.Health;
using Code.OfficeGame.BattleMode.HitBoxes;
using Code.OfficeGame.BattleMode.UI;
@@ -65,8 +66,10 @@ namespace Code.OfficeGame.BattleMode.Timeline
BattleActionDecisionPanel battleActionDecisionPanel,
HealthPanelsHolder healthPanelsHolder,
CameraStateMachine cameraStateMachine,
IParticleService particleService)
IParticleService particleService,
BattleModeCursorController cursorController)
{
_cursorController = cursorController;
_timelinePanel = timelinePanel;
_decisionPanel = battleActionDecisionPanel;
_healthPanelsHolder = healthPanelsHolder;
@@ -135,6 +138,7 @@ namespace Code.OfficeGame.BattleMode.Timeline
// =================== ОСНОВНОЙ ЦИКЛ БОЯ ===================
private CancellationToken _battleLoopCt;
private BattleModeCursorController _cursorController;
public async UniTask RunBattleLoopAsync(List<EntityProperties> entities, CancellationToken ctx)
{
@@ -255,8 +259,8 @@ namespace Code.OfficeGame.BattleMode.Timeline
if (entity.TeamData.Team == EntityTeam.ChaoticEvil)
{
var (enemyRes, enemyData) = await _enemyDeciders[entity.TeamData.DeciderType]
.DecideEnemy(ctx, entity, _battleActions);
var (enemyRes, enemyData) = _enemyDeciders[entity.TeamData.DeciderType]
.DecideEnemy(entity, _battleActions);
return new EntityActionSlotSnapshot
{
@@ -292,7 +296,7 @@ namespace Code.OfficeGame.BattleMode.Timeline
while (!ctx.IsCancellationRequested)
{
Cursor.lockState = CursorLockMode.Confined;
// Cursor.lockState = CursorLockMode.Confined;
if (cameraBattleState != null) cameraBattleState.battleDeciding = true;
await _decisionPanel.Open(ctx);
@@ -306,7 +310,7 @@ namespace Code.OfficeGame.BattleMode.Timeline
_simulator.RestoreSimulationToWorld(Track.GetFrame(_committedFrame.Value));
ApplyFrame(_committedFrame.Value, playOneShotVfx: false);
decider.MountDecider(entity);
await decider.MountDecider(entity);
bool waitingForFirstTarget = true;
try
@@ -316,7 +320,7 @@ namespace Code.OfficeGame.BattleMode.Timeline
// Пока цель ещё не выбрана — курсор залочен под прицеливание камеры.
// Как только цель выбрана (идёт превью) — курсор свободен (Confined),
// чтобы игрок мог двигать ползунок таймлайна (а вращать камеру через ПКМ).
Cursor.lockState = waitingForFirstTarget ? CursorLockMode.Locked : CursorLockMode.Confined;
// Cursor.lockState = waitingForFirstTarget ? CursorLockMode.Locked : CursorLockMode.Confined;
if (cameraBattleState != null) cameraBattleState.battleDeciding = !waitingForFirstTarget;
await _decisionPanel.Close(ctx);
@@ -368,7 +372,7 @@ namespace Code.OfficeGame.BattleMode.Timeline
finally
{
StopPreviewLoop();
decider.UnmountDecider();
await decider.UnmountDecider();
}
}
@@ -0,0 +1,14 @@
using System.Collections.Generic;
using Code.OfficeGame.BattleMode.Actions;
namespace Code.OfficeGame.BattleMode.Timeline
{
public interface IBattleAiResolver
{
bool TryResolveNextAction(
EntityProperties entity,
IReadOnlyDictionary<BattleActionType, BattleAction> actions,
out BattleActionDecisionResult decision,
out BattleActionData actionData);
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8c62bc0c68374905952a26eba8fbba54
timeCreated: 1795174068