< Summary

Information
Class: Trailblazer.Navigation.Motor.LocomotionProfile
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Navigation/Motor/Locomotion/Profiles/LocomotionProfile.cs
Line coverage
100%
Covered lines: 34
Uncovered lines: 0
Coverable lines: 34
Total lines: 132
Line coverage: 100%
Branch coverage
100%
Covered branches: 16
Total branches: 16
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%66100%
get_InstalledKinds()100%1010100%
CreateDefault()100%11100%
CreateCoreOnly()100%11100%
CreateBuilder()100%11100%
CreateBuilder(...)100%11100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Navigation/Motor/Locomotion/Profiles/LocomotionProfile.cs

#LineLine coverage
 1using System;
 2
 3namespace Trailblazer.Navigation.Motor;
 4
 5/// <summary>
 6/// Describes the installed locomotion modules for a object motor.
 7/// </summary>
 8public sealed class LocomotionProfile
 9{
 10    /// <summary>
 11    /// Initializes a new locomotion profile.
 12    /// </summary>
 87513    public LocomotionProfile(
 87514        MoveLocomotion move,
 87515        FallLocomotion fall,
 87516        PlatformLocomotion? platform = null,
 87517        JumpLocomotion? jump = null,
 87518        SlideLocomotion? slide = null,
 87519        WaterLocomotion? water = null,
 87520        FlyLocomotion? fly = null,
 87521        ClimbLocomotion? climb = null)
 22    {
 87523        Move = move ?? throw new ArgumentNullException(nameof(move));
 87424        Fall = fall ?? throw new ArgumentNullException(nameof(fall));
 87325        Platform = platform ?? new PlatformLocomotion();
 87326        Jump = jump;
 87327        Slide = slide;
 87328        Water = water;
 87329        Fly = fly;
 87330        Climb = climb;
 87331    }
 32
 33    /// <summary>
 34    /// Core movement configuration for the motor.
 35    /// </summary>
 36    public MoveLocomotion Move { get; }
 37
 38    /// <summary>
 39    /// Fall-state configuration for the motor.
 40    /// </summary>
 41    public FallLocomotion Fall { get; }
 42
 43    /// <summary>
 44    /// Required moving-platform locomotion.
 45    /// </summary>
 46    public PlatformLocomotion Platform { get; }
 47
 48    /// <summary>
 49    /// Optional jump locomotion.
 50    /// </summary>
 51    public JumpLocomotion? Jump { get; }
 52
 53    /// <summary>
 54    /// Optional slide locomotion.
 55    /// </summary>
 56    public SlideLocomotion? Slide { get; }
 57
 58    /// <summary>
 59    /// Optional water locomotion.
 60    /// </summary>
 61    public WaterLocomotion? Water { get; }
 62
 63    /// <summary>
 64    /// Optional flight locomotion.
 65    /// </summary>
 66    public FlyLocomotion? Fly { get; }
 67
 68    /// <summary>
 69    /// Optional climb locomotion.
 70    /// </summary>
 71    public ClimbLocomotion? Climb { get; }
 72
 73    /// <summary>
 74    /// Gets the installed locomotion flags for this profile.
 75    /// </summary>
 76    public LocomotionKind InstalledKinds
 77    {
 78        get
 79        {
 680            LocomotionKind result = LocomotionKind.Core;
 81
 682            if (Jump != null)
 583                result |= LocomotionKind.Jump;
 84
 685            if (Slide != null)
 286                result |= LocomotionKind.Slide;
 87
 688            if (Water != null)
 489                result |= LocomotionKind.Water;
 90
 691            if (Fly != null)
 392                result |= LocomotionKind.Fly;
 93
 694            if (Climb != null)
 495                result |= LocomotionKind.Climb;
 96
 697            return result;
 98        }
 99    }
 100
 101    /// <summary>
 102    /// Creates the default profile with all built-in locomotions installed.
 103    /// </summary>
 104    public static LocomotionProfile CreateDefault()
 105    {
 730106        return new LocomotionProfileBuilder().Build();
 107    }
 108
 109    /// <summary>
 110    /// Creates a minimal profile with only required locomotion behavior installed.
 111    /// </summary>
 112    public static LocomotionProfile CreateCoreOnly()
 113    {
 26114        return new LocomotionProfileBuilder(includeOptionalLocomotions: false).Build();
 115    }
 116
 117    /// <summary>
 118    /// Creates a new builder seeded with the default full locomotion profile.
 119    /// </summary>
 120    public static LocomotionProfileBuilder CreateBuilder()
 121    {
 1122        return new LocomotionProfileBuilder();
 123    }
 124
 125    /// <summary>
 126    /// Creates a new builder seeded from the currently installed handler locomotions.
 127    /// </summary>
 128    internal static LocomotionProfileBuilder CreateBuilder(LocomotionHandler handler)
 129    {
 2130        return LocomotionProfileBuilder.FromHandler(handler);
 131    }
 132}