< Summary

Class:ControllerBase
Assembly:bamlab.micromissiles
File(s):/github/workspace/Assets/Scripts/Controller/ControllerBase.cs
Covered lines:10
Uncovered lines:4
Coverable lines:14
Total lines:30
Line coverage:71.4% (10 of 14)
Covered branches:0
Total branches:0
Covered methods:4
Total methods:5
Method coverage:80% (4 of 5)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
ControllerBase(...)0%110100%
Plan()0%220100%
Plan(...)0%2100%

File(s)

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

#LineLine coverage
 1using UnityEngine;
 2
 3// Base implementation of a controller.
 4public abstract class ControllerBase : IController {
 5  // Agent that the controller is steering.
 1506  public IAgent Agent { get; init; }
 7
 428  public ControllerBase(IAgent agent) {
 219    Agent = agent;
 2110  }
 11
 12  // Plan the next optimal control to intercept the target.
 2313  public Vector3 Plan() {
 2414    if (Agent.TargetModel == null) {
 115      return Vector3.zero;
 16    }
 17
 2218    Transformation relativeTransformation = Agent.GetRelativeTransformation(Agent.TargetModel);
 2219    return Plan(relativeTransformation);
 2320  }
 21
 22  // Plan the next optimal control to the waypoint.
 023  public Vector3 Plan(in Vector3 waypoint) {
 024    Transformation relativeTransformation = Agent.GetRelativeTransformation(waypoint);
 025    return Plan(relativeTransformation);
 026  }
 27
 28  // Controller-dependent implementation of the control law.
 29  protected abstract Vector3 Plan(in Transformation relativeTransformation);
 30}