示例#1
0
        /// <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(); }
        }
示例#2
0
 /// <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="parachuteCase">Value to store the result in</param>
 public bool TryGetCase(int index, string type, ref CaseConfig parachuteCase)
 {
     if (caseNames.Length > 0 && CaseExists(caseNames[index]))
     {
         parachuteCase = GetCase(index, type);
         return(true);
     }
     Debug.LogWarning("[RealChute]: Could not find the case texture at  the index [" + index + "] within library");
     return(false);
 }
示例#3
0
 /// <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);
 }
示例#4
0
 /// <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 (CaseExists(name))
     {
         parachuteCase = GetCase(name);
         return(true);
     }
     if (name != string.Empty && name != "none")
     {
         Debug.LogWarning("[RealChute]: Could not find the " + name + " case texture within library");
     }
     return(false);
 }
示例#5
0
 /// <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);
 }
示例#6
0
        /// <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();
            }
        }
示例#7
0
 /// <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;
 }
示例#8
0
 /// <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;
 }
示例#9
0
 /// <summary>
 /// Returns the index of this case if it exists
 /// </summary>
 /// <param name="parachuteCase">Case config searched for</param>
 public int GetCaseIndex(CaseConfig parachuteCase)
 {
     return(cases.Keys.ToList().IndexOf(parachuteCase));
 }
示例#10
0
 /// <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="parachuteCase">Value to store the result in</param>
 public bool TryGetCase(int index, string type, ref CaseConfig parachuteCase)
 {
     if (caseNames.Length > 0 && CaseExists(caseNames[index]))
     {
         parachuteCase = GetCase(index, type);
         return true;
     }
     Debug.LogWarning("[RealChute]: Could not find the case texture at  the index [" + index + "] within library");
     return false;
 }
示例#11
0
 /// <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 (CaseExists(name))
     {
         parachuteCase = GetCase(name);
         return true;
     }
     if (name != string.Empty && name != "none") { Debug.LogWarning("[RealChute]: Could not find the " + name + " case texture within library"); }
     return false;
 }
示例#12
0
 /// <summary>
 /// Returns the index of this case if it exists
 /// </summary>
 /// <param name="parachuteCase">Case config searched for</param>
 public int GetCaseIndex(CaseConfig parachuteCase)
 {
     return cases.Keys.ToList().IndexOf(parachuteCase);
 }
示例#13
0
 /// <summary>
 /// Returns the index of this case if it exists
 /// </summary>
 /// <param name="parachuteCase">Case config searched for</param>
 public int GetCaseIndex(CaseConfig parachuteCase)
 {
     return cases.IndexOf(parachuteCase);
 }
示例#14
0
 /// <summary>
 /// Returns the index of this case if it exists
 /// </summary>
 /// <param name="parachuteCase">Case config searched for</param>
 public int GetCaseIndex(CaseConfig parachuteCase)
 {
     return(cases.IndexOf(parachuteCase));
 }