< Summary

Information
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 47
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_Context()100%11100%
get_KeepWaiting()100%11100%
get_Current()100%11100%
MoveNext()100%11100%
Reset()100%11100%
Dispose()100%11100%

File(s)

/home/runner/work/Gravitas/Gravitas/src/Gravitas/Support/Coroutines/LockedYieldInstructions/WaitForNextSimulate.cs

#LineLine coverage
 1//=======================================================================
 2// WaitForNextSimulate.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2026–present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8namespace Gravitas.Support;
 9
 10/// <summary>
 11/// A coroutine yield instruction that waits until the next Gravitas simulation frame.
 12/// </summary>
 13public readonly struct WaitForNextSimulate : ILockedYieldInstruction
 14{
 15    private readonly GravitasWorldContext _context;
 16    private readonly int _checkedInFrameCount;
 17
 18    /// <summary>
 19    /// Creates an instruction that waits until the context advances to another simulation frame.
 20    /// </summary>
 21    public WaitForNextSimulate(GravitasWorldContext context)
 22    {
 1323        SwiftThrowHelper.ThrowIfNull(context, nameof(context));
 24
 1325        _context = context;
 1326        _checkedInFrameCount = context.FrameCount;
 1327    }
 28
 29    /// <inheritdoc />
 1030    public GravitasWorldContext Context => _context;
 31
 32    /// <inheritdoc />
 33    public bool KeepWaiting =>
 934         _context.FrameCount == _checkedInFrameCount;
 35
 36    /// <inheritdoc />
 137    public object? Current => null;
 38
 39    /// <inheritdoc />
 240    public bool MoveNext() => KeepWaiting;
 41
 42    /// <inheritdoc />
 143    public void Reset() { }
 44
 45    /// <inheritdoc />
 1146    public void Dispose() { }
 47}