Exemple #1
0
        private void CreateAvatar()
        {
            XEditorUtil.ClearCreatures();

            List <int> list  = new List <int>();
            var        table = XFashionLibrary._profession.Table;

            presentid = table.Where(x => x.Shape == (int)shape).Select(x => x.PresentID).First();
            string path   = "Assets/BundleRes/Prefabs/Player_" + shape.ToString().ToLower() + ".prefab";
            var    prefab = AssetDatabase.LoadAssetAtPath <GameObject>(path);

            if (prefab != null)
            {
                GameObject root = GameObject.Find("Player");
                if (root == null)
                {
                    root = new GameObject("Player");
                    root.transform.position = new Vector3(0f, 0f, -8f);
                }
                go = Instantiate(prefab);
                go.transform.SetParent(root.transform);
                go.name = shape.ToString();
                go.transform.localScale    = Vector3.one;
                go.transform.rotation      = Quaternion.Euler(0, 180, 0);
                go.transform.localPosition = Vector3.zero;
                Selection.activeGameObject = go;
                fashionInfo    = XFashionLibrary.GetFashionsInfo(shape);
                fashionDesInfo = new string[fashionInfo.Length];
                for (int i = 0; i < fashionInfo.Length; i++)
                {
                    fashionDesInfo[i] = fashionInfo[i].name;
                }
            }
        }