/// <summary> /// This function tries to add the mapcomponent if it isn't already available /// </summary> /// <returns></returns> public static bool TryAddMapComponent(Map map) { MapComponent_ColonistSelections mc; if (IsMapComponentAvailable(map, out mc)) { return(true); } mc = new MapComponent_ColonistSelections(map); map.components.Add(mc); return(IsMapComponentAvailable(map, out mc)); }
/// <summary> /// This function provides the info, if this component is available or not /// </summary> /// <param name="mc"></param> /// <returns></returns> public static bool IsMapComponentAvailable(Map map, out MapComponent_ColonistSelections mc) { mc = null; for (int i = 0; i < map.components.Count; i++) { mc = map.components[i] as MapComponent_ColonistSelections; if (mc != null) { break; } } if (mc == null) { return(false); } return(true); }