Ejemplo n.º 1
0
        public void Initialize(DynamicCharacterAvatar Avatar)
        {
            foreach (GameObject go in CreatedObjects)
            {
                Destroy(go);
            }
            CreatedObjects.Clear();

            UMADnaBase[] DNA = Avatar.GetAllDNA();

            List <DNAHolder> ValidDNA = new List <DNAHolder>();

            foreach (UMADnaBase d in DNA)
            {
                string[] names  = d.Names;
                float[]  values = d.Values;

                for (int i = 0; i < names.Length; i++)
                {
                    string name = names[i];
                    if (IsThisCategory(name.ToLower()))
                    {
                        ValidDNA.Add(new DNAHolder(name, values[i], i, d));
                    }
                }
            }

            ValidDNA.Sort( );

            foreach (DNAHolder dna in ValidDNA)
            {
                GameObject go = GameObject.Instantiate(DnaEditor);
                go.transform.SetParent(ContentArea.transform);
                go.transform.localScale = new Vector3(1f, 1f, 1f);                //Set the scale back to 1
                DNAEditor de = go.GetComponentInChildren <DNAEditor>();
                de.Initialize(dna.name.BreakupCamelCase(), dna.index, dna.dnaBase, Avatar, dna.value);
                go.SetActive(true);
                CreatedObjects.Add(go);
            }
        }