예제 #1
0
 public static void PlayAnimation(Vector3 time, Vector3 step, Vector3 duration, int startindex, bool order, int triggerinverse, int inversestart, int endindex, int inverseend, int remberstartindex, bool attach = false)
 {
     if (startindex < 50 /*Fuzhi.mounts*/ && startindex >= 0)
     {
         Machine.singleton.MecBindings["Smallest3" + startindex + "_" + "Smallest2" + startindex].PlayAnimatin(time.x, step.x).AnimationAction(() =>
         {
             Machine.singleton.MecBindings["SSmallest3" + startindex + "_" + "SSmallest2" + startindex].PlayAnimatin(time.y, step.y).AnimationAction(() =>
             {
                 MechanMetaComponentBinding binding = Machine.singleton.MecBindings["Max3" + startindex + "_" + "Max2" + startindex].PlayAnimatin(time.z, step.z);
                 if (attach)
                 {
                     print(startindex + "   " + inverseend);
                     if (startindex == inverseend)
                     {
                         binding.AnimationAction(() =>
                         {
                             PlayAnimation(time, -step, duration, inverseend, !order, inverseend, endindex, inversestart, remberstartindex, inverseend);
                             inverse = true;
                             MonoBehaviour.print(inverseend + " " + !order + "  " + inverseend + "  " + endindex + "  " + inversestart + "  " + remberstartindex + "  " + inverseend);
                         }
                                                 );
                         return;
                     }
                 }
                 binding.AnimationAction(() =>
                 {
                     if (startindex != endindex)
                     {
                         if (startindex == triggerinverse && inverse)//待定
                         {
                             inverse = false;
                             PlayAnimation(time, -step, duration, inversestart, order, triggerinverse, inversestart, endindex, inverseend, remberstartindex, true);
                         }
                         if (order)
                         {
                             startindex++;
                         }
                         else
                         {
                             startindex--;
                         }
                         PlayAnimation(time, step, duration, startindex, order, triggerinverse, inversestart, endindex, inverseend, remberstartindex, attach);
                     }
                 }, duration.z);
             }, duration.y);
         }, duration.x);
     }
     else
     {
         MonoBehaviour.print("xsadsadsa");
     }
 }
예제 #2
0
    public void PlayInverse()
    {
        if (onceSmallest)
        {
            onceSmallest      = false;
            maxmecbing        = Machine.singleton.MecBindings["Max3" + index + "_" + "Max2" + index].PlayAnimatin(operaTime.x, step.x);
            startTimeS        = Time.time;
            maxinverStartTime = float.MaxValue;
            PlayAnimationWhenMax();
            //可以播放向前移动的动画
        }

        if (!onceSmallest)
        {
            if (maxmecbing != null && !maxmecbing.playing && remberinverseTime)
            {
                remberinverseTime = false;
                maxinverStartTime = Time.time;
                //PlayAnimationWhenMax();//可以播放动画暂停时间
            }
        }
        // if (AnimationManager.identification == 3)//臨時判斷
        //    return;
        if (!onceSmallest)
        {
            if (Time.time - maxinverStartTime > maxinverTime && onceinverMax)
            {
                onceinverMax = false;
                if (maxmecbing != null)
                {
                    maxmecbing.PlayAnimatin(operaTime.x, -step.x);
                    maxmecbing = null;
                }
            }
        }

        if (!onceinverMax)
        {
            if ((Time.time - startTimeS > distanceTime.x) && onceSSmallest)
            {
                onceSSmallest = false;
                Machine.singleton.MecBindings["SSmallest3" + index + "_" + "SSmallest2" + index].PlayAnimatin(operaTime.y, step.y);
                startTimeSS = Time.time;
            }
        }
        if (!onceSSmallest)
        {
            if ((Time.time - startTimeSS > distanceTime.y) && onceMax)
            {
                onceMax = false;
                Machine.singleton.MecBindings["Smallest3" + index + "_" + "Smallest2" + index].PlayAnimatin(operaTime.z, step.z);

                try
                {
                    Animation ani = GameObject.Find("HuBang").transform.GetChild(index).GetComponent <Animation>();
                    ani[ani.clip.name].speed          = -1;
                    ani[ani.clip.name].normalizedTime = 1;
                    ani.Play();
                }
                catch
                {
                }
            }
        }
    }