< Summary

Class:ThreatData
Assembly:bamlab.micromissiles
File(s):/github/workspace/Assets/Scripts/IADS/ThreatData.cs
Covered lines:8
Uncovered lines:18
Coverable lines:26
Total lines:49
Line coverage:30.7% (8 of 26)
Covered branches:0
Total branches:0
Covered methods:2
Total methods:5
Method coverage:40% (2 of 5)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
ThreatData(...)0%110100%
AssignInterceptor(...)0%6200%
RemoveInterceptor(...)0%6200%
MarkDestroyed()0%2100%

File(s)

/github/workspace/Assets/Scripts/IADS/ThreatData.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using UnityEngine;
 3
 4[System.Serializable]
 5public enum ThreatStatus { UNASSIGNED, ASSIGNED, DESTROYED }
 6[System.Serializable]
 7public class ThreatData {
 8  public Threat Threat;
 9  [SerializeField]
 10  private ThreatStatus _status;
 11
 512  public int assignedInterceptorCount = 0;
 13  public ThreatStatus Status {
 1514    get { return _status; }
 15  }
 16  public string ThreatID;
 17  [SerializeField]
 18  private List<Interceptor> _assignedInterceptors;  // Changed from property to field
 19
 020  public void AssignInterceptor(Interceptor interceptor) {
 021    if (Status == ThreatStatus.DESTROYED) {
 022      Debug.LogError(
 23          $"AssignInterceptor: Threat {ThreatID} is destroyed, cannot assign interceptor");
 024      return;
 25    }
 026    _status = ThreatStatus.ASSIGNED;
 027    _assignedInterceptors.Add(interceptor);
 028    assignedInterceptorCount++;
 029  }
 30
 031  public void RemoveInterceptor(Interceptor interceptor) {
 032    _assignedInterceptors.Remove(interceptor);
 033    if (_assignedInterceptors.Count == 0) {
 034      _status = ThreatStatus.UNASSIGNED;
 035    }
 036    assignedInterceptorCount--;
 037  }
 38
 039  public void MarkDestroyed() {
 040    _status = ThreatStatus.DESTROYED;
 041  }
 42  // Constructor remains the same
 1043  public ThreatData(Threat threat, string threatID) {
 544    Threat = threat;
 545    _status = ThreatStatus.UNASSIGNED;
 546    ThreatID = threatID;
 547    _assignedInterceptors = new List<Interceptor>();  // Initialize the list
 548  }
 49}