< Summary

Class:ControllerBase
Assembly:bamlab.micromissiles
File(s):/github/workspace/Assets/Scripts/Controller/ControllerBase.cs
Covered lines:8
Uncovered lines:6
Coverable lines:14
Total lines:30
Line coverage:57.1% (8 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%6200%
Plan(...)0%110100%

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.
 228366  public IAgent Agent { get; init; }
 7
 19108  public ControllerBase(IAgent agent) {
 9559    Agent = agent;
 95510  }
 11
 12  // Plan the next optimal control to intercept the target.
 013  public Vector3 Plan() {
 014    if (Agent.TargetModel == null) {
 015      return Vector3.zero;
 16    }
 17
 018    Transformation relativeTransformation = Agent.GetRelativeTransformation(Agent.TargetModel);
 019    return Plan(relativeTransformation);
 020  }
 21
 22  // Plan the next optimal control to the waypoint.
 699523  public Vector3 Plan(in Vector3 waypoint) {
 699524    Transformation relativeTransformation = Agent.GetRelativeTransformation(waypoint);
 699525    return Plan(relativeTransformation);
 699526  }
 27
 28  // Controller-dependent implementation of the control law.
 29  protected abstract Vector3 Plan(in Transformation relativeTransformation);
 30}