Inheritance: MonoBehaviour
Esempio n. 1
0
    private void OnFaceUpdate(string msg_type, object body)
    {
        FunMessage msg  = body as FunMessage;
        object     obj  = network.GetMessage(msg, MessageType.sc_face);
        FaceUpdate face = obj as FaceUpdate;

        if (face_callbacks.ContainsKey(face.user_id))
        {
            face_callbacks[face.user_id](face);
        }
    }
 private void Reset()
 {
     m_faceUpdate = GetComponent <FaceUpdate>();
 }
 // Start is called before the first frame update
 void Awake()
 {
     this.animator   = GetComponent <Animator>();
     this.faceUpdate = GetComponent <FaceUpdate>();
 }
 public void ChangeFace(FaceUpdate face)
 {
     anim.CrossFade(face.clip, 0);
     anim.SetLayerWeight(face.layer, 1f);
 }
Esempio n. 5
0
        static void SetPluginImportSettings()
        {
            GameObject unitychan = GameObject.Find("unitychan");

            if (unitychan != null)
            {
                unitychan.transform.localEulerAngles = new Vector3(0, 180, 0);

                Animator animator = unitychan.GetComponent <Animator> ();

                AnimatorController animCon = animator.runtimeAnimatorController as AnimatorController;
                var layers = animCon.layers;
                foreach (var layer in layers)
                {
                    if (layer.stateMachine.name == "Base Layer")
                    {
                        layer.iKPass = true;
                    }
                }
                EditorUtility.SetDirty(animator);

                IdleChanger idleChanger = unitychan.GetComponent <IdleChanger> ();
                idleChanger.enabled = false;

                FaceUpdate faceUpdate = unitychan.GetComponent <FaceUpdate> ();
                faceUpdate.enabled = false;

                HeadLookAtIKController headLookAtIKController = FindObjectOfType <HeadLookAtIKController> ();
                if (headLookAtIKController != null)
                {
                    headLookAtIKController.animator = animator;

                    EditorUtility.SetDirty(headLookAtIKController);
                }

                HeadRotationController headRotationController = FindObjectOfType <HeadRotationController> ();
                if (headRotationController != null)
                {
                    headRotationController.target = GameObject.Find("Character1_Head").transform;

                    EditorUtility.SetDirty(headRotationController);
                }

                UnityChanDlibFaceBlendShapeController unityChanDlibFaceBlendShapeController = FindObjectOfType <UnityChanDlibFaceBlendShapeController> ();
                if (unityChanDlibFaceBlendShapeController != null)
                {
                    unityChanDlibFaceBlendShapeController.EYE_DEF = GameObject.Find("EYE_DEF").GetComponent <SkinnedMeshRenderer> ();
                    unityChanDlibFaceBlendShapeController.EL_DEF  = GameObject.Find("EL_DEF").GetComponent <SkinnedMeshRenderer> ();
                    unityChanDlibFaceBlendShapeController.BLW_DEF = GameObject.Find("BLW_DEF").GetComponent <SkinnedMeshRenderer> ();
                    unityChanDlibFaceBlendShapeController.MTH_DEF = GameObject.Find("MTH_DEF").GetComponent <SkinnedMeshRenderer> ();


                    EditorUtility.SetDirty(unityChanDlibFaceBlendShapeController);
                }

                UnityChanFaceAnimationClipController unityChanFaceAnimationClipController = FindObjectOfType <UnityChanFaceAnimationClipController> ();
                if (unityChanFaceAnimationClipController != null)
                {
                    unityChanFaceAnimationClipController.animator = animator;

                    EditorUtility.SetDirty(unityChanFaceAnimationClipController);
                }

                EditorUtility.SetDirty(unitychan);
            }
            else
            {
                Debug.LogError("There is no \"unitychan\" prefab in the scene. Please add \"unitychan\" prefab to the scene.");
            }
        }
 public void ChangeFace(FaceUpdate face)
 {
     anim.CrossFade(face.clip, 0);
     anim.SetLayerWeight(face.layer, 1f);
 }