/// <summary> /// Adds all descriptors to the specified list. /// </summary> /// <param name="go">The game object to describe.</param> /// <param name="simpleScreen">Whether the descriptors are to be shown in the /// simplified info screen.</param> /// <param name="descriptors">The location where the descriptors will be added.</param> internal static void GetAllDescriptors(GameObject go, bool simpleScreen, ICollection <Descriptor> descriptors) { var comps = ListPool <IGameObjectEffectDescriptor, DescriptorSorter> .Allocate(); go.GetComponents(comps); if (go.TryGetComponent(out StateMachineController smc)) { smc.AddStateMachineDescriptors(comps); } comps.Sort(DescriptorSorter.Instance); int n = comps.Count; for (int i = 0; i < n; i++) { descriptors.AddDescriptors(comps[i].GetDescriptors(go), simpleScreen); } comps.Recycle(); if (go.TryGetComponent(out KPrefabID prefabID)) { descriptors.AddDescriptors(prefabID.AdditionalRequirements, simpleScreen); descriptors.AddDescriptors(prefabID.AdditionalEffects, simpleScreen); } }