/// <summary> /// Sees if the config exists and stores it in th ref value /// </summary> /// <param name="name">Name of the ref value</param> /// <param name="parachuteCase">Variable to store the result in</param> public bool TryGetCase(string name, ref CaseConfig parachuteCase) { if (ContainsCase(name)) { parachuteCase = this.Cases[name]; return(true); } if (!string.IsNullOrEmpty(name) && this.Cases.Count > 0) { Debug.LogError($"[RealChute]: Could not find the CaseConfig \"{name}\" in the library"); } return(false); }
/// <summary> /// Gets the case config of the given index if possible /// </summary> /// <param name="index">Index of the case config searched for</param> /// <param name="type">Type of the parachute</param> /// <param name="parachuteCase">Value to store the result in</param> public bool TryGetCase(int index, string type, ref CaseConfig parachuteCase) { if (ContainsType(type)) { string[] names = this.Types[type]; if (names.IndexInRange(index)) { parachuteCase = this.Cases[names[index]]; return(true); } } if (!string.IsNullOrEmpty(type) && this.Types.Count > 0 && this.Cases.Count > 0) { Debug.LogError($"[RealChute]: Could not find the CaseConfig of \"{type}\" type at the [{index}] index in the library"); } return(false); }