Пример #1
0
        private void init_delta_measures()
        {
            for (int i = 0; i < measures_relat_data.Count; i++)
            {
                string[] relation      = measures_relat_data[i];
                string   m_name        = relation[0];
                string   modifier_name = relation[1];
                for (int j = 0; j < this.categories.Count; j++)
                {
                    HumanCategory category = this.categories[j];
                    for (int k = 0; k < category.modifiers.Count; k++)
                    {
                        HumanModifier modifier = category.modifiers[k];
                        if (modifier.name == modifier_name)
                        {
                            foreach (string prop in modifier.properties)
                            {
                                this.character_data[prop] = 0.0f;
                                this.combine_morphings(modifier, false, true);
                                float measure1 = this.calc_measure_float(m_name, null);

                                this.character_data[prop] = 1.0f;
                                this.combine_morphings(modifier, false, true);
                                float measure3 = this.calc_measure_float(m_name, null);

                                //#Last measure also restores the value to 0.5
                                this.character_data[prop] = 0.5f;
                                this.combine_morphings(modifier, false, true);
                                float measure2 = this.calc_measure_float(m_name, null);

                                string delta_name = modifier_name + prop;

                                float delta1 = measure1 - measure2;
                                float delta3 = measure3 - measure2;


                                KeyValuePair <string, float[]> kvp = new KeyValuePair <string, float[]>(delta_name, new float[] { delta1, delta3 });
                                delta_measures.Add(kvp);
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        private void init_character_data()
        {
            categories = new List <HumanCategory>();


            for (int i = 0; i < this.morph_data.Count; i++)
            {
                string   morph_name = this.morph_data[i].morph_name;
                string[] components = morph_name.Split(new Char[] { '_' });
                string   compCut    = components[0];
                if (components[0].Length >= 4)
                {
                    compCut = components[0].Remove(4, components[0].Length - 4);
                }

                //erst ab hier die Bastioni Funktion
                if (!this.no_categories.Contains(compCut))
                {
                    if (components.Length == 3)
                    {
                        category_name = components[0];
                        HumanCategory category = HumanCategory.GetByName(this.categories, category_name);

                        if (category == null)
                        {
                            category      = new HumanCategory();
                            category.name = category_name;
                            this.categories.Add(category);
                        }


                        string        modifier_name = components[0] + "_" + components[1];
                        HumanModifier modifier      = HumanModifier.GetByName(category.modifiers, modifier_name);
                        if (modifier == null)
                        {
                            modifier      = new HumanModifier();
                            modifier.name = modifier_name;
                            category.modifiers.Add(modifier);
                        }

                        string[] elements = components[1].Split(new Char[] { '-' });
                        for (int j = 0; j < elements.Length; j++)
                        {
                            string element = elements[j];
                            string prop    = components[0] + "_" + element;
                            if (!modifier.properties.Contains(prop))
                            {
                                modifier.properties.Add(prop);
                            }
                            if (character_data.ContainsKey(prop))
                            {
                                character_data[prop] = 0.5f;
                            }
                            else
                            {
                                character_data.Add(prop, 0.5f);
                            }
                        }
                    }
                }
            }
        }