< Summary

Information
Class: Lattice.ECS.Session.SessionTickProcessor
Assembly: Lattice
File(s): /home/runner/work/Sideline/Sideline/godot/scripts/lattice/ECS/Session/SessionTickProcessor.cs
Line coverage
95%
Covered lines: 22
Uncovered lines: 1
Coverable lines: 23
Total lines: 65
Line coverage: 95.6%
Branch coverage
87%
Covered branches: 7
Total branches: 8
Branch coverage: 87.5%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Execute(...)87.5%8895.65%

File(s)

/home/runner/work/Sideline/Sideline/godot/scripts/lattice/ECS/Session/SessionTickProcessor.cs

#LineLine coverage
 1using System;
 2using Lattice.ECS.Core;
 3using Lattice.Math;
 4
 5namespace Lattice.ECS.Session
 6{
 7    /// <summary>
 8    /// SessionRuntime 的 Tick 管线执行器。
 9    /// 负责统一驱动输入、系统模拟、结构提交、清理与历史写入阶段。
 10    /// </summary>
 11    internal sealed class SessionTickProcessor
 12    {
 13        public void Execute(
 14            Frame frame,
 15            FP deltaTime,
 16            Action<SessionTickStage> enterStage,
 17            Action<Frame> applyInputs,
 18            Action<Frame, FP> updateSystems,
 19            Action<Frame> cleanupFrame,
 20            Action<Frame> captureHistory,
 21            Action<Frame, FP>? onFrameUpdate,
 22            bool raiseFrameUpdateEvent,
 23            bool captureHistoryStage)
 24        {
 62525            enterStage(SessionTickStage.InputApply);
 62526            applyInputs(frame);
 27
 62528            bool structuralScopeStarted = false;
 29            try
 30            {
 62531                enterStage(SessionTickStage.Simulation);
 62532                frame.BeginDeferredStructuralChanges();
 62533                structuralScopeStarted = true;
 62534                updateSystems(frame, deltaTime);
 35
 62536                enterStage(SessionTickStage.StructuralCommit);
 62537                frame.CommitStructuralChanges();
 62538                structuralScopeStarted = false;
 39
 62540                enterStage(SessionTickStage.Cleanup);
 62541                cleanupFrame(frame);
 42
 62543                if (raiseFrameUpdateEvent)
 44                {
 51745                    onFrameUpdate?.Invoke(frame, deltaTime);
 46                }
 47
 62548                if (captureHistoryStage)
 49                {
 58650                    enterStage(SessionTickStage.HistoryCapture);
 58651                    captureHistory(frame);
 52                }
 62553            }
 54            finally
 55            {
 62556                if (structuralScopeStarted)
 57                {
 058                    frame.AbortStructuralChanges();
 59                }
 60
 62561                enterStage(SessionTickStage.Idle);
 62562            }
 62563        }
 64    }
 65}