< 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: 32
Uncovered lines: 0
Coverable lines: 32
Total lines: 124
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%

File(s)

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

#LineLine coverage
 1//=======================================================================
 2// LocomotionProfile.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;
 9
 10namespace Trailblazer.Navigation.Motor;
 11
 12/// <summary>
 13/// Describes the installed locomotion modules for a object motor.
 14/// </summary>
 15public sealed class LocomotionProfile
 16{
 17    /// <summary>
 18    /// Initializes a new locomotion profile.
 19    /// </summary>
 127620    public LocomotionProfile(
 127621        MoveLocomotion move,
 127622        FallLocomotion fall,
 127623        PlatformLocomotion? platform = null,
 127624        JumpLocomotion? jump = null,
 127625        SlideLocomotion? slide = null,
 127626        WaterLocomotion? water = null,
 127627        FlyLocomotion? fly = null,
 127628        ClimbLocomotion? climb = null)
 29    {
 127630        Move = move ?? throw new ArgumentNullException(nameof(move));
 127531        Fall = fall ?? throw new ArgumentNullException(nameof(fall));
 127432        Platform = platform ?? new PlatformLocomotion();
 127433        Jump = jump;
 127434        Slide = slide;
 127435        Water = water;
 127436        Fly = fly;
 127437        Climb = climb;
 127438    }
 39
 40    /// <summary>
 41    /// Core movement configuration for the motor.
 42    /// </summary>
 43    public MoveLocomotion Move { get; }
 44
 45    /// <summary>
 46    /// Fall-state configuration for the motor.
 47    /// </summary>
 48    public FallLocomotion Fall { get; }
 49
 50    /// <summary>
 51    /// Required moving-platform locomotion.
 52    /// </summary>
 53    public PlatformLocomotion Platform { get; }
 54
 55    /// <summary>
 56    /// Optional jump locomotion.
 57    /// </summary>
 58    public JumpLocomotion? Jump { get; }
 59
 60    /// <summary>
 61    /// Optional slide locomotion.
 62    /// </summary>
 63    public SlideLocomotion? Slide { get; }
 64
 65    /// <summary>
 66    /// Optional water locomotion.
 67    /// </summary>
 68    public WaterLocomotion? Water { get; }
 69
 70    /// <summary>
 71    /// Optional flight locomotion.
 72    /// </summary>
 73    public FlyLocomotion? Fly { get; }
 74
 75    /// <summary>
 76    /// Optional climb locomotion.
 77    /// </summary>
 78    public ClimbLocomotion? Climb { get; }
 79
 80    /// <summary>
 81    /// Gets the installed locomotion flags for this profile.
 82    /// </summary>
 83    public LocomotionKind InstalledKinds
 84    {
 85        get
 86        {
 787            LocomotionKind result = LocomotionKind.Core;
 88
 789            if (Jump != null)
 590                result |= LocomotionKind.Jump;
 91
 792            if (Slide != null)
 393                result |= LocomotionKind.Slide;
 94
 795            if (Water != null)
 596                result |= LocomotionKind.Water;
 97
 798            if (Fly != null)
 399                result |= LocomotionKind.Fly;
 100
 7101            if (Climb != null)
 4102                result |= LocomotionKind.Climb;
 103
 7104            return result;
 105        }
 106    }
 107
 108    /// <summary>
 109    /// Creates the default profile with all built-in locomotions installed.
 110    /// </summary>
 111    public static LocomotionProfile CreateDefault()
 112    {
 1070113        return new LocomotionProfileBuilder().Build();
 114    }
 115
 116    /// <summary>
 117    /// Creates a minimal profile with only required locomotion behavior installed.
 118    /// </summary>
 119    public static LocomotionProfile CreateCoreOnly()
 120    {
 35121        return new LocomotionProfileBuilder(includeOptionalLocomotions: false).Build();
 122    }
 123
 124}