< Summary

Information
Class: Trailblazer.Navigation.Motor.TrekCondition
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Navigation/Motor/Trek/TrekCondition.cs
Line coverage
100%
Covered lines: 19
Uncovered lines: 0
Coverable lines: 19
Total lines: 71
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
Clone()100%22100%
Reset()100%11100%
RecordData(...)100%11100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Navigation/Motor/Trek/TrekCondition.cs

#LineLine coverage
 1using Chronicler;
 2using FixedMathSharp;
 3using System;
 4using System.Runtime.CompilerServices;
 5
 6namespace Trailblazer.Navigation.Motor;
 7
 8/// <summary>
 9/// Represents the traversal state of a scout, including its movement medium and surface interactions.
 10/// </summary>
 11[Serializable]
 12public struct TrekCondition : IRecordable
 13{
 14    /// <summary>
 15    /// Defines the medium in which the scout is currently moving.
 16    /// </summary>
 17    public TraversalMedium Medium;
 18
 19    /// <summary>
 20    /// Stores the height of the current surface, typically used for ground and water interactions.
 21    /// </summary>
 22    public Fixed64 SurfaceLevel;
 23
 24    /// <summary>
 25    /// Stores the height of the ceiling above the scout, if applicable.
 26    /// Defaults to Fixed64.MAX_VALUE, meaning no ceiling.
 27    /// </summary>
 301928    public Fixed64 CeilingLevel = Fixed64.MAX_VALUE;
 29
 30    /// <summary>
 31    /// Contains data about the ground state, if applicable.
 32    /// </summary>
 33    public GroundCondition? GroundState;
 34
 35    /// <summary>
 36    /// Initializes a new instance of the TrekCondition class.
 37    /// </summary>
 301938    public TrekCondition() { }
 39
 40    /// <summary>
 41    /// Creates a deep copy of the current <see cref="TrekCondition"/> instance.
 42    /// </summary>
 43    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 14244    public TrekCondition Clone() => new()
 14245    {
 14246        Medium = Medium,
 14247        SurfaceLevel = SurfaceLevel,
 14248        GroundState = GroundState?.Clone(),
 14249        CeilingLevel = CeilingLevel
 14250    };
 51
 52    /// <summary>
 53    /// Resets the traversal condition to default values, indicating an unknown state.
 54    /// </summary>
 55    public void Reset()
 56    {
 357        Medium = TraversalMedium.Unknown;
 358        SurfaceLevel = Fixed64.Zero;
 359        GroundState = null;
 360        CeilingLevel = Fixed64.MAX_VALUE;
 361    }
 62
 63    /// <inheritdoc/>
 64    public void RecordData(IChronicler chronicler)
 65    {
 13066        RecordValues.Look(chronicler, ref Medium, "Medium", TraversalMedium.Unknown);
 13067        RecordValues.Look(chronicler, ref SurfaceLevel, "SurfaceLevel", Fixed64.Zero);
 13068        RecordValues.Look(chronicler, ref CeilingLevel, "CeilingLevel", Fixed64.MAX_VALUE);
 13069        RecordNullableDeep.Look(chronicler, ref GroundState, "GroundState");
 13070    }
 71}