Esempio n. 1
0
 //Apparition de l'icone du personnage actuel | Current character Icon appearance
 void ActuelFadeInTick(object sender, EventArgs e)
 {
     opacitePersonnageActuel++;
     FaceContainer.Refresh();
     if (opacitePersonnageActuel < 10)
     {
         return;
     }
     ActuelFadeIn.Enabled = false;
 }
Esempio n. 2
0
    public void LoadElements()
    {
        int               x      = 0;
        List <Object>     _base  = new List <Object>();
        List <GameObject> male   = new List <GameObject>();
        List <GameObject> female = new List <GameObject>();

        _base.AddRange(Resources.LoadAll(root + "/base/Males", typeof(Object)));
        x = 0;
        for (int i = 0; i < _base.Count; i++)
        {
            GameObject g = _base[i] as GameObject;
            if ((g != null) && g.transform.root == g.transform)
            {
                male.Add(g);
                x++;
            }
        }
        _base.Clear();
        _base.AddRange(Resources.LoadAll(root + "/base/Females", typeof(Object)));
        x = 0;
        for (int i = 0; i < _base.Count; i++)
        {
            GameObject g = _base[i] as GameObject;
            if ((g != null) && g.transform.root == g.transform)
            {
                female.Add(g);
                x++;
            }
        }

        Base = new FaceContainer(male.ToArray(), female.ToArray());

        List <Object> _eye = new List <Object>();

        male.Clear();
        female.Clear();
        _eye.AddRange(Resources.LoadAll(root + "/eyes/Males", typeof(Object)));
        x = 0;
        for (int i = 0; i < _eye.Count; i++)
        {
            GameObject g = _eye[i] as GameObject;
            if ((g != null) && g.transform.root == g.transform)
            {
                male.Add(g);
                x++;
            }
        }
        _eye.Clear();
        _eye.AddRange(Resources.LoadAll(root + "/eyes/Females", typeof(Object)));
        x = 0;
        for (int i = 0; i < _eye.Count; i++)
        {
            GameObject g = _eye[i] as GameObject;
            if ((g != null) && g.transform.root == g.transform)
            {
                female.Add(g);
                x++;
            }
        }
        Eye        = new FaceContainer(male.ToArray(), female.ToArray());
        Eye.Colour = ColorType.Offset;


        List <Object> _nose = new List <Object>();

        male   = new List <GameObject>();
        female = new List <GameObject>();
        _nose.AddRange(Resources.LoadAll(root + "/nose/Males", typeof(Object)));
        x = 0;
        for (int i = 0; i < _nose.Count; i++)
        {
            GameObject g = _nose[i] as GameObject;
            if ((g != null))
            {
                male.Add(g);
                x++;
            }
        }
        _nose.Clear();
        _nose.AddRange(Resources.LoadAll(root + "/nose/Females", typeof(Object)));
        x = 0;
        for (int i = 0; i < _nose.Count; i++)
        {
            GameObject g = _nose[i] as GameObject;
            if ((g != null))
            {
                female.Add(g);
                x++;
            }
        }

        Nose        = new FaceContainer(male.ToArray(), female.ToArray());
        Nose.Colour = ColorType.Nose;

        List <Object> _brow = new List <Object>();

        male   = new List <GameObject>();
        female = new List <GameObject>();
        _brow.AddRange(Resources.LoadAll(root + "/brow/Males", typeof(Object)));
        x = 0;
        for (int i = 0; i < _brow.Count; i++)
        {
            GameObject g = _brow[i] as GameObject;
            if ((g != null))
            {
                male.Add(g);
                x++;
            }
        }
        _brow.Clear();
        _brow.AddRange(Resources.LoadAll(root + "/brow/Females", typeof(Object)));
        x = 0;
        for (int i = 0; i < _brow.Count; i++)
        {
            GameObject g = _brow[i] as GameObject;
            if ((g != null))
            {
                female.Add(g);
                x++;
            }
        }
        Brow        = new FaceContainer(male.ToArray(), female.ToArray());
        Brow.Colour = ColorType.Hair;


        List <Object> _hair = new List <Object>();

        male   = new List <GameObject>();
        female = new List <GameObject>();
        _hair.AddRange(Resources.LoadAll(root + "/hair/Males", typeof(Object)));
        x = 0;
        for (int i = 0; i < _hair.Count; i++)
        {
            GameObject g = _hair[i] as GameObject;
            if ((g != null))
            {
                male.Add(g);
                x++;
            }
        }
        _hair.Clear();
        _hair.AddRange(Resources.LoadAll(root + "/hair/Females", typeof(Object)));
        x = 0;
        for (int i = 0; i < _hair.Count; i++)
        {
            GameObject g = _hair[i] as GameObject;
            if ((g != null))
            {
                female.Add(g);
                x++;
            }
        }
        Hair        = new FaceContainer(male.ToArray(), female.ToArray());
        Hair.Colour = ColorType.Hair;

        List <Object> _ear = new List <Object>();

        male   = new List <GameObject>();
        female = new List <GameObject>();
        _ear.AddRange(Resources.LoadAll(root + "/ears/Males", typeof(Object)));
        x = 0;
        for (int i = 0; i < _ear.Count; i++)
        {
            GameObject g = _ear[i] as GameObject;
            if ((g != null))
            {
                male.Add(g);
                x++;
            }
        }
        _ear.Clear();
        _ear.AddRange(Resources.LoadAll(root + "/ears/Females", typeof(Object)));
        x = 0;
        for (int i = 0; i < _ear.Count; i++)
        {
            GameObject g = _ear[i] as GameObject;
            if ((g != null))
            {
                female.Add(g);
                x++;
            }
        }
        Ear        = new FaceContainer(male.ToArray(), female.ToArray());
        Ear.Colour = ColorType.Skin;


        List <Object> _jaw = new List <Object>();

        male   = new List <GameObject>();
        female = new List <GameObject>();
        _jaw.AddRange(Resources.LoadAll(root + "/jaw/Males", typeof(Object)));
        x = 0;
        for (int i = 0; i < _jaw.Count; i++)
        {
            GameObject g = _jaw[i] as GameObject;
            if ((g != null))
            {
                male.Add(g);
                x++;
            }
        }
        _jaw.Clear();
        _jaw.AddRange(Resources.LoadAll(root + "/jaw/Females", typeof(Object)));
        x = 0;
        for (int i = 0; i < _jaw.Count; i++)
        {
            GameObject g = _jaw[i] as GameObject;
            if ((g != null))
            {
                female.Add(g);
                x++;
            }
        }
        Jaw        = new FaceContainer(male.ToArray(), female.ToArray());
        Jaw.Colour = ColorType.Offset;

        List <Object> _glasses = new List <Object>();

        male = new List <GameObject>();
        _glasses.AddRange(Resources.LoadAll(root + "/acc/glasses", typeof(Object)));
        x = 0;
        for (int i = 0; i < _glasses.Count; i++)
        {
            GameObject g = _glasses[i] as GameObject;
            if (g != null)
            {
                male.Add(g);
                x++;
            }
        }

        Glasses        = new FaceContainer(male.ToArray(), null);
        Glasses.Colour = ColorType.None;

        OffsetCurrent = Color.white;

        elements_loaded = true;
    }
Esempio n. 3
0
    void OnGUI()
    {
        if (Data == null)
        {
            Data = GameObject.Find("GameManager").GetComponent <GameData>();
        }
        if (Gen == null)
        {
            Gen = GameObject.Find("Generator").GetComponent <Generator>();
            if (Gen)
            {
                Gen.LoadElements();
            }
        }

        GUILayout.Label("Generator", EditorStyles.boldLabel);
        if (GUILayout.Button("Get Elements"))
        {
            Gen.LoadElements();
        }
        EditorGUILayout.BeginHorizontal();
        GUI.color = Color.green;



        if (GUILayout.Button("Generate"))
        {
            /*int facenum = 30;
             * time_total = facenum * time_per_face;
             * time_init = (float) EditorApplication.timeSinceStartup;	*/
            Gen.Destroy();
            Gen.TargetData = Gen.EditorGenerate();

            Gen.GenerateNewFace(Gen.TargetData);
        }

        if (progress < time_total)
        {
            EditorUtility.DisplayProgressBar("Simple", "Show", progress / time_total);
            Gen.Destroy();
            Gen.TargetGrand = Gen.Generate(0);
            FaceObj f = Gen.GenerateFace(Gen.TargetGrand);
            f.transform.localRotation = Quaternion.identity;
            f.transform.localScale    = new Vector3(1.0F, 0.6F, 1.0F);
        }
        else
        {
            EditorUtility.ClearProgressBar();
        }
        progress = (float)(EditorApplication.timeSinceStartup - time_init);


        GUI.color = Color.white;

        GUI.color = Color.yellow;
        if (GUILayout.Button("Randomise"))
        {
            Gen.Destroy();
            Gen.TargetData = Gen.GenerateGrand();
            Gen.GenerateNewFace(Gen.TargetData);
        }
        GUI.color = Color.white;

        GUI.color = Color.yellow;
        if (GUILayout.Button("Delete"))
        {
            Gen.Destroy();
        }
        GUI.color = Color.white;
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.Space();

        tab = GUILayout.Toolbar(tab, new string[] { "Base", "Hair", "Jaw", "Eyes",
                                                    "Nose", "Brows", "Ears" });
        FaceContainer targ = FOA(tab);

        if (targ == null)
        {
            return;
        }

        /*EditorGUILayout.BeginHorizontal();
         * GUILayout.Label("Elements: " + targ.Length, EditorStyles.boldLabel);
         * targ.Colour = (ColorType) EditorGUILayout.EnumPopup(targ.Colour);
         * EditorGUILayout.EndHorizontal();
         *
         * EditorGUILayout.BeginHorizontal();
         * if(GUILayout.Button("<",  GUILayout.Width(50))) targ.Index --;
         * GUILayout.Label(targ.Current.Name +"", EditorStyles.boldLabel);
         * if(GUILayout.Button(">",  GUILayout.Width(50))) targ.Index++;
         * EditorGUILayout.EndHorizontal();
         * EditorGUILayout.Space();
         *
         * EditorGUILayout.BeginHorizontal();
         * GUILayout.Label("Scale", GUILayout.Width(50));
         * targ._Scale.x = EditorGUILayout.Slider(targ._Scale.x, 0.1F, 2.5F, GUILayout.Width(150));
         * targ._Scale.y = EditorGUILayout.Slider(targ._Scale.y, 0.1F, 2.5F, GUILayout.Width(150));
         * EditorGUILayout.EndHorizontal();
         *
         * if(targ == Gen.Base)
         * {
         *      EditorGUILayout.BeginHorizontal();
         *      GUILayout.Label("Skin", GUILayout.Width(50));
         *      Gen.SkinCurrent = EditorGUILayout.ColorField(Gen.SkinCurrent, GUILayout.Width(150));
         *      if(GUILayout.Button("<",  GUILayout.Width(20))) Gen.SkinCurrent = Gen.CycleSkin(1);
         *      if(GUILayout.Button(">",  GUILayout.Width(20))) Gen.SkinCurrent = Gen.CycleSkin(-1);
         *
         *      EditorGUILayout.EndHorizontal();
         *
         *      EditorGUILayout.BeginHorizontal();
         *      GUILayout.Label("Hair", GUILayout.Width(50));
         *      Gen.HairCurrent = EditorGUILayout.ColorField(Gen.HairCurrent, GUILayout.Width(150));
         *      if(GUILayout.Button("<",  GUILayout.Width(20))) Gen.HairCurrent = Gen.CycleHair(1);
         *      if(GUILayout.Button(">",  GUILayout.Width(20))) Gen.HairCurrent = Gen.CycleHair(-1);
         *      EditorGUILayout.EndHorizontal();
         *
         *      EditorGUILayout.BeginHorizontal();
         *      GUILayout.Label("Col B", GUILayout.Width(50));
         *      Gen.OffsetCurrent = EditorGUILayout.ColorField(Gen.OffsetCurrent, GUILayout.Width(150));
         *      EditorGUILayout.EndHorizontal();
         * }
         * else
         * {
         *              EditorGUILayout.Space();
         *              EditorGUILayout.BeginHorizontal();
         *              GUILayout.Label("Position", GUILayout.Width(50));
         *              targ._Position.x = EditorGUILayout.Slider(targ._Position.x, -30.0F, 30.0F, GUILayout.Width(150));
         *              targ._Position.y = EditorGUILayout.Slider(targ._Position.y, -30.0F, 30.0F, GUILayout.Width(150));
         *              EditorGUILayout.EndHorizontal();
         *
         *              EditorGUILayout.Space();
         *
         *              EditorGUILayout.BeginHorizontal();
         *              GUILayout.Label("Rotation", GUILayout.Width(50));
         *              targ._Rotation.z = EditorGUILayout.Slider("", targ._Rotation.z, -25.0F, 25.0F, GUILayout.Width(150));
         *              EditorGUILayout.EndHorizontal();
         *
         *              EditorGUILayout.Space();
         *
         *              if(targ.Symm)
         *              {
         *                      EditorGUILayout.BeginHorizontal();
         *                      GUILayout.Label("Distance", GUILayout.Width(50));
         *                      targ.Symm_Distance = EditorGUILayout.Slider("", targ.Symm_Distance, -3.0F, 3.0F, GUILayout.Width(150));
         *                      EditorGUILayout.EndHorizontal();
         *                      EditorGUILayout.Space();
         *
         *                      EditorGUILayout.BeginHorizontal();
         *                      GUILayout.Label("Scale Diff", GUILayout.Width(50));
         *                      targ.Symm_ScaleDiff = EditorGUILayout.Slider("", targ.Symm_ScaleDiff, -0.5F, 0.5F, GUILayout.Width(150));
         *                      EditorGUILayout.EndHorizontal();
         *                      EditorGUILayout.Space();
         *              }
         *
         *              if(targ == Gen.Eye && Gen.TargetGrand)
         *              {
         *                      if(GUILayout.Button("Pupil",  GUILayout.Width(80)))
         *                      {
         *                              Gen.TargetGrand.Face[0][0].Img[1].enabled = !Gen.TargetGrand.Face[0][0].Img[1].enabled;
         *                              Gen.TargetGrand.Face[1][0].Img[1].enabled = !Gen.TargetGrand.Face[1][0].Img[1].enabled;
         *                      }
         *              }
         * }*/
        /*if(Gen.TargetData != null)
         * {
         *      changes = false;
         *      Gen.CheckEditorInfo(Gen.TargetData);
         *      if(Gen.TargetData.Faces.Count > 0 && Gen.TargetData.Faces[0] != null)
         *               Gen.TargetData.Faces[0].Create(Gen.TargetData.Info);
         *
         * }*/
    }