< Summary

Class:WaypointController
Assembly:bamlab.micromissiles
File(s):/github/workspace/Assets/Scripts/Controller/WaypointController.cs
Covered lines:9
Uncovered lines:0
Coverable lines:9
Total lines:22
Line coverage:100% (9 of 9)
Covered branches:0
Total branches:0
Covered methods:2
Total methods:2
Method coverage:100% (2 of 2)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
WaypointController(...)0%110100%
PlanImpl(...)0%110100%

File(s)

/github/workspace/Assets/Scripts/Controller/WaypointController.cs

#LineLine coverage
 1using System;
 2using UnityEngine;
 3
 4// The waypoint controller steers the agent to the target using direct linear guidance.
 5public class WaypointController : IController {
 6  // Desired speed in m/s.
 7  float _desiredSpeed;
 8
 69  public WaypointController(Agent agent, float desiredSpeed) : base(agent) {
 310    _desiredSpeed = desiredSpeed;
 311  }
 12
 313  protected override Vector3 PlanImpl(in Transformation relativeTransformation) {
 314    Vector3 toWaypoint = relativeTransformation.position.cartesian;
 315    Vector3 desiredVelocity = toWaypoint.normalized * _desiredSpeed;
 16
 17    // Calculate the acceleration needed to reach the desired velocity within one time step.
 318    Vector3 accelerationInput =
 19        (desiredVelocity - _agent.GetVelocity()) / (float)Time.fixedDeltaTime;
 320    return accelerationInput;
 321  }
 22}