Exemplo n.º 1
0
 protected override void OnModifyOffset()
 {
     for (int i = 0; i < this.warps.Length; i++)
     {
         float   warpWeight = this.GetWarpWeight(i);
         Vector3 vector     = this.warps[i].warpTo.position - this.warps[i].warpFrom.position;
         AnimationWarping.EffectorMode effectorMode = this.effectorMode;
         if (effectorMode != AnimationWarping.EffectorMode.PositionOffset)
         {
             if (effectorMode == AnimationWarping.EffectorMode.Position)
             {
                 this.ik.solver.GetEffector(this.warps[i].effector).position       = this.ik.solver.GetEffector(this.warps[i].effector).bone.position + vector;
                 this.ik.solver.GetEffector(this.warps[i].effector).positionWeight = this.weight * warpWeight;
             }
         }
         else
         {
             this.ik.solver.GetEffector(this.warps[i].effector).positionOffset += vector * warpWeight * this.weight;
         }
     }
     if (this.lastMode == AnimationWarping.EffectorMode.Position && this.effectorMode == AnimationWarping.EffectorMode.PositionOffset)
     {
         AnimationWarping.Warp[] array = this.warps;
         for (int j = 0; j < array.Length; j++)
         {
             AnimationWarping.Warp warp = array[j];
             this.ik.solver.GetEffector(warp.effector).positionWeight = 0f;
         }
     }
     this.lastMode = this.effectorMode;
 }
Exemplo n.º 2
0
 private void OnDisable()
 {
     if (this.effectorMode != AnimationWarping.EffectorMode.Position)
     {
         return;
     }
     AnimationWarping.Warp[] array = this.warps;
     for (int i = 0; i < array.Length; i++)
     {
         AnimationWarping.Warp warp = array[i];
         this.ik.solver.GetEffector(warp.effector).positionWeight = 0f;
     }
 }