Ejemplo n.º 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(); }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Sees if there is a ModelConfig at the specified index and stores it in the ref value if possible.
 /// </summary>
 /// <param name="index">Index of the ModelConfig to look for</param>
 /// <param name="model">Value to store the result in</param>
 public bool TryGetModel(int index, ref ModelConfig model)
 {
     if (this._modelNames.IndexInRange(index))
     {
         string name = this._modelNames[index];
         if (ContainsModel(name))
         {
             model = this._models[name];
             return true;
         }
     }
     if (this._models.Count > 0) { Debug.LogError("[RealChute]: Could not find the ModelConfig at the index [" + index + "] in the library"); }
     return false;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Sees if the model config of the given name exists and stores it in the ref value
        /// </summary>
        /// <param name="name">Name of the config searched for</param>
        /// <param name="model">Value to store the result in</param>
        public bool TryGetModel(string name, ref ModelConfig model, bool isTransformName = false)
        {
            if (isTransformName)
            {
                if (ContainsModel(name, true))
                {
                    model = this._transforms[name];
                    return true;
                }
                if (!string.IsNullOrEmpty(name) && this._transforms.Count > 0) { Debug.LogError("[RealChute]: Could not find the transform \"" + name + "\" in the library"); }
                return false;
            }

            if (ContainsModel(name))
            {
                model = this._models[name];
                return true;
            }
            if (!string.IsNullOrEmpty(name) && this._models.Count > 0) { Debug.LogError("[RealChute]: Could not find the ModelConfig \"" + name + "\" in the library"); }
            return false;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Returns the index of the model config if it exists
 /// </summary>
 /// <param name="model">Model config searched for</param>
 public int GetModelIndex(ModelConfig model)
 {
     return(models.Keys.ToList().IndexOf(model));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Sees if there is a ModelConfig at the specified index and stores it in the ref value if possible.
 /// </summary>
 /// <param name="index">Index of the ModelConfig to look for</param>
 /// <param name="model">Value to store the result in</param>
 public bool TryGetModel(int index, ref ModelConfig model)
 {
     if (modelNames.Length > 0 && ModelExists(modelNames[index]))
     {
         model = GetModel(index);
         return true;
     }
     Debug.LogWarning("[RealChute]: Could not find the parachute model at the index [" + index + "] within library");
     return false;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Sees if the model config of the given name exists and stores it in the ref value
 /// </summary>
 /// <param name="name">Name of the config searched for</param>
 /// <param name="model">Value to store the result in</param>
 public bool TryGetModel(string name, ref ModelConfig model, bool isTransformName = false)
 {
     if (ModelExists(name, isTransformName))
     {
         model = GetModel(name, isTransformName);
         return true;
     }
     if (name != string.Empty && name != "none") { Debug.LogWarning("[RealChute]: Could not find the " + name + " parachute model within library"); }
     return false;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Returns the index of the model config if it exists
 /// </summary>
 /// <param name="model">Model config searched for</param>
 public int GetModelIndex(ModelConfig model)
 {
     return models.Keys.ToList().IndexOf(model);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Returns the index of the model config if it exists
 /// </summary>
 /// <param name="model">Model config searched for</param>
 public int GetModelIndex(ModelConfig model)
 {
     return models.IndexOf(model);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Returns the index of the model config if it exists
 /// </summary>
 /// <param name="model">Model config searched for</param>
 public int GetModelIndex(ModelConfig model)
 {
     return(models.IndexOf(model));
 }