/// <summary> /// Sees if the given canopy config exists and stores it in the ref value /// </summary> /// <param name="name">Name of the config searched for</param> /// <param name="canopy">Value to store th result in</param> public bool TryGetCanopy(string name, ref CanopyConfig canopy) { if (ContainsCanopy(name)) { canopy = this.Canopies[name]; return(true); } if (!string.IsNullOrEmpty(name) && this.Canopies.Count > 0) { Debug.LogError($"[RealChute]: Could not find the CanopyConfig \"{name}\" in the library"); } return(false); }
/// <summary> /// Tries to get the canopy config associated to the index and returns false if it does not exist /// </summary> /// <param name="index">Index of the canopy config</param> /// <param name="canopy">Value to store the result in</param> public bool TryGetCanopy(int index, ref CanopyConfig canopy) { if (this.CanopyNames.IndexInRange(index)) { string name = this.CanopyNames[index]; if (ContainsCanopy(name)) { canopy = this.Canopies[name]; return(true); } } if (this.Canopies.Count > 0) { Debug.LogError($"[RealChute]: Could not find the CanopyConfig at the [{index}] index in the library"); } return(false); }