private Vessel GetDominantVessel(Vessel v1, Vessel v2)
{
// Check 1 - Dominant vessel will be the higher type
if (v1.vesselType > v2.vesselType) {
return v1;
}
if (v1.vesselType < v2.vesselType) {
return v2;
}
// Check 2- If type are the same, dominant vessel will be the heaviest
float diffMass = Mathf.Abs((v1.GetTotalMass() - v2.GetTotalMass()));
if (diffMass >= 0.01f) {
return v1.GetTotalMass() <= v2.GetTotalMass() ? v2 : v1;
}
// Check 3 - If weight is similar, dominant vessel will be the one with the higher ID
return v1.id.CompareTo(v2.id) <= 0 ? v2 : v1;
}