public static int GetSelectableFeaturesCount(this BlueprintFeatureSelection selection, UnitDescriptor unit) { int count = 0; NoSelectionIfAlreadyHasFeature component = selection.GetComponent <NoSelectionIfAlreadyHasFeature>(); if ((UnityEngine.Object)component == (UnityEngine.Object)null) { return(count); } if (component.AnyFeatureFromSelection) { foreach (BlueprintFeature allFeature in selection.AllFeatures) { if (!unit.Progression.Features.HasFact((BlueprintFact)allFeature)) { count++; } } } foreach (BlueprintFeature feature in component.Features) { if (!unit.Progression.Features.HasFact((BlueprintFact)feature)) { count++; } } return(count); }