Preview improvements. StillBug

This commit is contained in:
ThomasCharester committed 2026-11-20 15:19:22 +03:00
1 parent f927552adc
commit 3678d039e3
161 files changed
+34009 -61541

No files matched your search

@@ -67,8 +67,10 @@ namespace Code.OfficeGame.BattleMode.Timeline
HealthPanelsHolder healthPanelsHolder,
CameraStateMachine cameraStateMachine,
IParticleService particleService,
BattleModeCursorController cursorController)
BattleModeCursorController cursorController,
IBattleAiResolver aiResolver)
{
_aiResolver = aiResolver;
_cursorController = cursorController;
_timelinePanel = timelinePanel;
_decisionPanel = battleActionDecisionPanel;
@@ -80,7 +82,7 @@ namespace Code.OfficeGame.BattleMode.Timeline
_battleActionDeciders = battleActionDeciders.ToDictionary(x => x.DeciderType);
_enemyDeciders = enemyDeciders.ToDictionary(x => x.EnemyDeciderType);
_simulator = new BattleSimulator(_battleActions);
_simulator = new BattleSimulator(_battleActions, aiResolver);
foreach (var action in _battleActions.Values)
action.SetSimulationContext(_simulator);
}
@@ -139,6 +141,7 @@ namespace Code.OfficeGame.BattleMode.Timeline
private CancellationToken _battleLoopCt;
private BattleModeCursorController _cursorController;
private IBattleAiResolver _aiResolver;
public async UniTask RunBattleLoopAsync(List<EntityProperties> entities, CancellationToken ctx)
{
@@ -182,7 +185,7 @@ namespace Code.OfficeGame.BattleMode.Timeline
HideAllPreviewVisuals();
RebakeFromCommitted(recordGhosts: false);
int nextPauseFrame = Track.FindNextPauseFrame(_committedFrame.Value);
int nextPauseFrame = Track.FindNextPlayerPauseFrame(_committedFrame.Value, _entities);
if (nextPauseFrame <= _committedFrame.Value)
{
await UniTask.Yield(PlayerLoopTiming.Update, ctx);
@@ -259,18 +262,23 @@ namespace Code.OfficeGame.BattleMode.Timeline
if (entity.TeamData.Team == EntityTeam.ChaoticEvil)
{
var (enemyRes, enemyData) = _enemyDeciders[entity.TeamData.DeciderType]
.DecideEnemy(entity, _battleActions);
var lastCompleted = Track.GetFrame(_committedFrame.Value)
.Entities[slotIndex].ActionSlot.LastCompletedActionType;
return new EntityActionSlotSnapshot
if (_aiResolver.TryResolveNextAction(entity, _battleActions, out var enemyRes, out var enemyData))
{
ActionType = enemyRes.ActionType,
DecisionResult = enemyRes,
ActionData = enemyData,
LastCompletedActionType = Track.GetFrame(_committedFrame.Value).Entities[slotIndex].ActionSlot.LastCompletedActionType,
ActionStartFrame = _committedFrame.Value,
EstimatedEndFrame = _committedFrame.Value + enemyData.TotalFrames
};
return new EntityActionSlotSnapshot
{
ActionType = enemyRes.ActionType,
DecisionResult = enemyRes,
ActionData = enemyData,
LastCompletedActionType = lastCompleted,
ActionStartFrame = _committedFrame.Value,
EstimatedEndFrame = _committedFrame.Value + enemyData.TotalFrames
};
}
return EntityActionSlotSnapshot.CreateNone(_committedFrame.Value, lastCompleted);
}
if (entity.TeamData.Team == EntityTeam.Good)