Esempio n. 1
0
        static void CreateRobotFacePartSO()
        {
            RobotFacePartSO so = ScriptableObject.CreateInstance <RobotFacePartSO>();

            SetInfo(so);
            AssetDatabase.CreateAsset(so, robotFilePath);
        }
Esempio n. 2
0
        static void SetInfo(RobotFacePartSO so)
        {
            Transform[] gos = Selection.activeGameObject.GetComponentsInChildren <Transform>();
            EFacePart   eFacePart;

            for (int ix = 0; ix < gos.Length; ++ix)
            {
                if (Enum.TryParse <EFacePart>(gos[ix].tag, out eFacePart))
                {
                    Debug.Log(gos[ix].tag);
                    RobotFacePart rfp = new RobotFacePart();
                    rfp.facialPartEnum = eFacePart;
                    rfp.partPosition   = gos[ix].localPosition;
                    rfp.partScale      = gos[ix].localScale;
                    rfp.partSprite     = gos[ix].GetComponent <SpriteRenderer>().sprite;

                    so.faceParts.Add(rfp);
                }
            }
        }