private string GetVariant() { string compoundVariant = null; FeatureAsset feature = FeatureEditorWindow.GetInstance().Feature; Vector2Int[] selectedPositions = feature.GetSelectedSections(); foreach (Vector2Int position in selectedPositions) { if (feature.TryGetSection(position, out Section section)) { if (compoundVariant == null) { //first variant found compoundVariant = section.variant; } else if (compoundVariant != section.variant) { //variant names are not uniform return(null); } //variant names are uniform so far, continue } } return(compoundVariant); }
// Confirms a given section exists at a position. private void ValidateSection(FeatureAsset feature, Vector2Int featurePos) { feature.TryGetSection(featurePos * 2, out Labrys.FeatureEditor.Section section); Assert.IsNotNull(section, "Section expected to exist at position: " + (featurePos * 2)); }