Found movement vulnurability
This commit is contained in:
1 parent
0288afb00a
commit
9203f269db
31 files changed
+212319
-4344
No files matched your search
@@ -92,7 +92,7 @@ namespace Code.OfficeGame.BattleMode.Timeline
|
||||
{
|
||||
await UniTask.Yield(PlayerLoopTiming.Update, ctx);
|
||||
|
||||
accumulator += Time.unscaledDeltaTime;
|
||||
accumulator += Mathf.Min(Time.unscaledDeltaTime, 0.1f);
|
||||
|
||||
while (accumulator >= TickDelta)
|
||||
{
|
||||
@@ -109,6 +109,7 @@ namespace Code.OfficeGame.BattleMode.Timeline
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO ЗАПУСКАТЬ ДВА ЦИКЛА ПОЛНЫЙ И ДО ПРЕРЫВАНИЯ
|
||||
private async UniTask PreviewBattleLoopAsync(int frameCount,
|
||||
Dictionary<EntityId, EntityProperties> entities,
|
||||
CancellationToken ctx)
|
||||
@@ -153,7 +154,7 @@ namespace Code.OfficeGame.BattleMode.Timeline
|
||||
if (!resultsSnapshots.TryGetValue(entityId, out var actionDecisionResult)
|
||||
|| !actionDataSnapshots.TryGetValue(entityId, out var battleActionData))
|
||||
continue;
|
||||
|
||||
|
||||
bool actionChanged = false;
|
||||
|
||||
if (!_actionDecisionResults.TryAdd(entityId, actionDecisionResult))
|
||||
@@ -162,14 +163,15 @@ namespace Code.OfficeGame.BattleMode.Timeline
|
||||
!= _actionDecisionResults[entityId].ActionType;
|
||||
|
||||
if (actionChanged)
|
||||
_actionDecisionResults[entityId] = actionDecisionResult;
|
||||
_actionDecisionResults[entityId] = actionDecisionResult.GetSnapshot();
|
||||
else
|
||||
_actionDecisionResults[entityId]?.RestoreSnapshot(actionDecisionResult);
|
||||
}
|
||||
|
||||
if (!_battleActionDatas.TryAdd(entityId, battleActionData))
|
||||
{
|
||||
if (actionChanged) _battleActionDatas[entityId] = battleActionData;
|
||||
if (actionChanged)
|
||||
_battleActionDatas[entityId] = battleActionData.GetSnapshot();
|
||||
else _battleActionDatas[entityId]?.RestoreSnapshot(battleActionData);
|
||||
}
|
||||
|
||||
@@ -180,29 +182,40 @@ namespace Code.OfficeGame.BattleMode.Timeline
|
||||
private async UniTask PlayTimelineForCertainFrames(int frameCount, CancellationToken ctx)
|
||||
{
|
||||
float accumulator = 0f;
|
||||
|
||||
|
||||
while (frameCount > 0 && !ctx.IsCancellationRequested)
|
||||
{
|
||||
await UniTask.Yield(PlayerLoopTiming.Update, ctx);
|
||||
bool isCanceled = await UniTask.Yield(PlayerLoopTiming.Update, ctx).SuppressCancellationThrow();
|
||||
if (isCanceled) break;
|
||||
|
||||
accumulator += Time.unscaledDeltaTime;
|
||||
accumulator += Mathf.Min(Time.unscaledDeltaTime, 0.1f);
|
||||
|
||||
while (accumulator >= TickDelta)
|
||||
while (accumulator >= TickDelta && frameCount > 0 && !ctx.IsCancellationRequested)
|
||||
{
|
||||
accumulator -= TickDelta;
|
||||
|
||||
frameCount--;
|
||||
|
||||
|
||||
var readyEntities = SimulateSingleFrame(_entities);
|
||||
|
||||
if (readyEntities.Length > 0)
|
||||
{
|
||||
foreach (var entityID in readyEntities)
|
||||
foreach (var entityId in readyEntities)
|
||||
{
|
||||
_battleActionDatas.Remove(entityID);
|
||||
// _battleActionDatas.Remove(entityID);
|
||||
// _actionDecisionResults.Remove(entityID);
|
||||
|
||||
_actionDecisionResults.Remove(entityID);
|
||||
_battleActionDatas[entityId] = new WaitBattleActionData {
|
||||
TotalFrames = frameCount,
|
||||
WaitFrames = frameCount
|
||||
};
|
||||
_actionDecisionResults[entityId] = new FrameBattleActionDeciderResult
|
||||
{
|
||||
ActionType = BattleActionType.Wait,
|
||||
FrameCount = frameCount,
|
||||
ResultCode = BattleActionDecisionResultCode.Decided
|
||||
};
|
||||
}
|
||||
// return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -300,7 +313,7 @@ namespace Code.OfficeGame.BattleMode.Timeline
|
||||
((CameraBattleModeState)_cameraStateMachine.CurrentBaseState).battleDeciding = false;
|
||||
|
||||
await _battleActionDecisionPanel.Close(ctx);
|
||||
|
||||
|
||||
decisionResult = await _battleActionDeciders[deciderType].GetDecision();
|
||||
decisionResult.ActionType = decidedActionType;
|
||||
|
||||
|
||||
Reference in new issue
Block a user