Exemple #1
0
 public void Setup(ConfigFaceAnimation config, FacePartControl leftEye, FacePartControl rightEye, FacePartControl mouth)
 {
     this._leftEye  = leftEye;
     this._rightEye = rightEye;
     this._mouth    = mouth;
     this.BuildAnimationFrameInfo(config);
 }
        private void Awake()
        {
            this._faceAnimation = new FaceAnimation();
            ConfigFaceAnimation config = Resources.Load <ConfigFaceAnimation>("FaceAnimation/Mei");

            this.leftEyeControl = new FacePartControl();
            this.leftEyeControl.Init(this.leftEyeProvider, this.leftEye);
            this.rightEyeControl = new FacePartControl();
            this.rightEyeControl.Init(this.rightEyeProvider, this.rightEye);
            this.mouthControl = new FacePartControl();
            this.mouthControl.Init(this.mouthProvider, this.mouth);
            this._faceAnimation.Setup(config, this.leftEyeControl, this.rightEyeControl, this.mouthControl);
        }
Exemple #3
0
 public void Init(Animator animator, int characterId, int heartLevel, Renderer leftEyeRenderer, Renderer rightEyeRenderer, Renderer mouthRenderer, IFaceMatInfoProvider leftEyeProvider, IFaceMatInfoProvider rightEyeProvider, IFaceMatInfoProvider mouthProvider, Transform headRoot = null)
 {
     if (!this._init)
     {
         this._animator   = animator;
         this._heartLevel = heartLevel;
         string characterName = this.CharacterName(characterId);
         this._touchPatternList = TouchPatternData.GetTouchPatternList(characterName);
         this._itemIndexRecord  = new List <int>(20);
         this._faceAnimation    = new FaceAnimation();
         ConfigFaceAnimation faceAnimation = FaceAnimationData.GetFaceAnimation(characterName);
         FacePartControl     leftEye       = new FacePartControl();
         leftEye.Init(leftEyeProvider, leftEyeRenderer);
         FacePartControl rightEye = new FacePartControl();
         rightEye.Init(rightEyeProvider, rightEyeRenderer);
         FacePartControl mouth = new FacePartControl();
         mouth.Init(mouthProvider, mouthRenderer);
         this._faceAnimation.Setup(faceAnimation, leftEye, rightEye, mouth);
         if (this._faceEffect != null)
         {
             this._faceEffect.Uninit();
             this._faceEffect = null;
         }
         if (headRoot != null)
         {
             GameObject original = Resources.Load <GameObject>("FaceEffect/FFX_" + characterName);
             if (original != null)
             {
                 GameObject     obj3      = UnityEngine.Object.Instantiate <GameObject>(original);
                 MonoFaceEffect component = obj3.GetComponent <MonoFaceEffect>();
                 if (component != null)
                 {
                     this._faceEffect = new FaceEffect();
                     obj3.transform.SetParent(headRoot, false);
                     this._faceEffect.Init(component);
                 }
                 else
                 {
                     UnityEngine.Object.Destroy(obj3);
                 }
             }
         }
         this.enable = false;
         this._init  = true;
     }
 }