< 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: 78
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
 1//=======================================================================
 2// TrekCondition.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2024-present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using System;
 9using System.Runtime.CompilerServices;
 10using Chronicler;
 11using FixedMathSharp;
 12
 13namespace Trailblazer.Navigation.Motor;
 14
 15/// <summary>
 16/// Represents the traversal state of a scout, including its movement medium and surface interactions.
 17/// </summary>
 18[Serializable]
 19public struct TrekCondition : IRecordable
 20{
 21    /// <summary>
 22    /// Defines the medium in which the scout is currently moving.
 23    /// </summary>
 24    public TraversalMedium Medium;
 25
 26    /// <summary>
 27    /// Stores the height of the current surface, typically used for ground and water interactions.
 28    /// </summary>
 29    public Fixed64 SurfaceLevel;
 30
 31    /// <summary>
 32    /// Stores the height of the ceiling above the scout, if applicable.
 33    /// Defaults to Fixed64.MaxValue, meaning no ceiling.
 34    /// </summary>
 371935    public Fixed64 CeilingLevel = Fixed64.MaxValue;
 36
 37    /// <summary>
 38    /// Contains data about the ground state, if applicable.
 39    /// </summary>
 40    public GroundCondition? GroundState;
 41
 42    /// <summary>
 43    /// Initializes a new instance of the TrekCondition class.
 44    /// </summary>
 371945    public TrekCondition() { }
 46
 47    /// <summary>
 48    /// Creates a deep copy of the current <see cref="TrekCondition"/> instance.
 49    /// </summary>
 50    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 33151    public TrekCondition Clone() => new()
 33152    {
 33153        Medium = Medium,
 33154        SurfaceLevel = SurfaceLevel,
 33155        GroundState = GroundState?.Clone(),
 33156        CeilingLevel = CeilingLevel
 33157    };
 58
 59    /// <summary>
 60    /// Resets the traversal condition to default values, indicating an unknown state.
 61    /// </summary>
 62    public void Reset()
 63    {
 2964        Medium = TraversalMedium.Unknown;
 2965        SurfaceLevel = Fixed64.Zero;
 2966        GroundState = null;
 2967        CeilingLevel = Fixed64.MaxValue;
 2968    }
 69
 70    /// <inheritdoc/>
 71    public void RecordData(IChronicler chronicler)
 72    {
 22973        RecordValues.Look(chronicler, ref Medium, "Medium", TraversalMedium.Unknown);
 22974        RecordValues.Look(chronicler, ref SurfaceLevel, "SurfaceLevel", Fixed64.Zero);
 22975        RecordValues.Look(chronicler, ref CeilingLevel, "CeilingLevel", Fixed64.MaxValue);
 22976        RecordNullableDeep.Look(chronicler, ref GroundState, "GroundState");
 22977    }
 78}