/// <summary> /// Initiates all the texture and model nodes in this model config /// </summary> public TextureConfig(ConfigNode node) { node.TryGetValue("name", ref _name); foreach(ConfigNode cfg in node.nodes) { if (cfg.name == "CASE_TEXTURE") { CaseConfig parachuteCase = new CaseConfig(cfg); _cases.Add(parachuteCase); continue; } if (cfg.name == "CANOPY_TEXTURE") { CanopyConfig canopy = new CanopyConfig(cfg); _canopies.Add(canopy); continue; } if (cfg.name == "CANOPY_MODEL") { ModelConfig model = new ModelConfig(cfg); _models.Add(model); continue; } } if (_cases.Count > 0) { _caseNames = _cases.Select(c => c.name).ToArray(); } if (_canopies.Count > 0) { _canopyNames = _canopies.Select(c => c.name).ToArray(); } if (_models.Count > 0) { _modelNames = _models.Select(m => m.name).ToArray(); } }
/// <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 (canopyNames.Length > 0 && CanopyExists(canopyNames[index])) { canopy = GetCanopy(index); return(true); } Debug.LogWarning("[RealChute]: Could not find the canopy texture at the index [" + index + "] within library"); return(false); }
/// <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> /// 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 (CanopyExists(name)) { canopy = GetCanopy(name); return(true); } if (name != string.Empty && name != "none") { Debug.LogWarning("[RealChute]: Could not find the " + name + " canopy texture within 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); }
/// <summary> /// Initiates all the texture and model nodes in this model config /// </summary> public TextureConfig(ConfigNode node) { node.TryGetValue("name", ref _name); foreach (ConfigNode cfg in node.nodes) { if (cfg.name == "CASE_TEXTURE") { CaseConfig parachuteCase = new CaseConfig(cfg); _cases.Add(parachuteCase); continue; } if (cfg.name == "CANOPY_TEXTURE") { CanopyConfig canopy = new CanopyConfig(cfg); _canopies.Add(canopy); continue; } if (cfg.name == "CANOPY_MODEL") { ModelConfig model = new ModelConfig(cfg); _models.Add(model); continue; } } if (_cases.Count > 0) { _caseNames = _cases.Select(c => c.name).ToArray(); } if (_canopies.Count > 0) { _canopyNames = _canopies.Select(c => c.name).ToArray(); } if (_models.Count > 0) { _modelNames = _models.Select(m => m.name).ToArray(); } }
/// <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; }
/// <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> /// Returns the index of the canopy config if it exists /// </summary> /// <param name="canopy">Canopy config searched for</param> public int GetCanopyIndex(CanopyConfig canopy) { return(canopies.Keys.ToList().IndexOf(canopy)); }
/// <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 (canopyNames.Length > 0 && CanopyExists(canopyNames[index])) { canopy = GetCanopy(index); return true; } Debug.LogWarning("[RealChute]: Could not find the canopy texture at the index [" + index + "] within library"); return false; }
/// <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 (CanopyExists(name)) { canopy = GetCanopy(name); return true; } if (name != string.Empty && name != "none") { Debug.LogWarning("[RealChute]: Could not find the " + name + " canopy texture within library"); } return false; }
/// <summary> /// Returns the index of the canopy config if it exists /// </summary> /// <param name="canopy">Canopy config searched for</param> public int GetCanopyIndex(CanopyConfig canopy) { return canopies.Keys.ToList().IndexOf(canopy); }
/// <summary> /// Returns the index of the canopy config if it exists /// </summary> /// <param name="canopy">Canopy config searched for</param> public int GetCanopyIndex(CanopyConfig canopy) { return canopies.IndexOf(canopy); }
/// <summary> /// Returns the index of the canopy config if it exists /// </summary> /// <param name="canopy">Canopy config searched for</param> public int GetCanopyIndex(CanopyConfig canopy) { return(canopies.IndexOf(canopy)); }