Пример #1
0
 public static bool IsPlaying(GameObject target)
 {
     WhiteCat.TweenInterpolator tip = target.GetComponent <WhiteCat.TweenInterpolator>();
     if (tip == null)
     {
         return(false);
     }
     return(tip.isPlaying);
 }
Пример #2
0
 void Awake()
 {
     interpolator = TweenInterpolator.Create(
         gameObject: gameObject,
         isPlaying: false,
         duration: 0.8f,
         method: TweenMethod.EaseInBackOut,
         onUpdate: factor => rectTransform.anchoredPosition = from + (to - from) * factor);
 }
Пример #3
0
 public void AddEndListener(UnityEngine.Events.UnityAction call)
 {
     if (null == mPolator)
     {
         mPolator          = gameObject.AddComponent <WhiteCat.TweenInterpolator>();
         mPolator.enabled  = false;
         mPolator.wrapMode = WhiteCat.WrapMode.Once;
     }
     mPolator.onArriveAtEnding.AddListener(call);
 }
Пример #4
0
 public void SetDurationDelay(float totalTime, float delay)
 {
     if (null == mPolator)
     {
         mPolator          = gameObject.AddComponent <WhiteCat.TweenInterpolator>();
         mPolator.enabled  = false;
         mPolator.wrapMode = WhiteCat.WrapMode.Once;
     }
     mPolator.duration = totalTime;
     mPolator.delay    = delay;
 }
Пример #5
0
    public static void CreateBezierCutsceneClip()
    {
        GameObject go = new GameObject("New Cutscene Clip");

        go.AddComponent <CutsceneClip>();
        go.AddComponent <WhiteCat.BezierPath>();
        WhiteCat.TweenInterpolator intp = go.AddComponent <WhiteCat.TweenInterpolator>();
        intp.enabled  = false;
        intp.duration = 10;
        if (SceneView.lastActiveSceneView != null)
        {
            go.transform.position = SceneView.lastActiveSceneView.camera.transform.position +
                                    SceneView.lastActiveSceneView.camera.transform.forward * 4f;
        }
    }
Пример #6
0
    void SetData(GameObject path)
    {
        pathObj = path;
        mPath   = path.GetComponent <WhiteCat.BezierPath>();

        mDrive      = gameObject.AddComponent <WhiteCat.PathDriver>();
        mDrive.path = mPath;

        mTween      = gameObject.AddComponent <WhiteCat.TweenPathDriver>();
        mTween.from = 0f;
        mTween.to   = mDrive.path.pathTotalLength;

        if (mPolator == null)
        {
            mPolator          = gameObject.AddComponent <WhiteCat.TweenInterpolator>();
            mPolator.enabled  = false;
            mPolator.wrapMode = WhiteCat.WrapMode.Once;
        }
    }
Пример #7
0
        /// <summary> 添加插值器到物体上 </summary>
        public static TweenInterpolator Create(
            GameObject gameObject,
            bool isPlaying                  = true,
            float delay                     = 0.0f,
            float duration                  = 1.0f,
            float speed                     = 1.0f,
            TweenMethod method              = TweenMethod.Linear,
            WrapMode wrapMode               = WrapMode.Once,
            TimeLine timeLine               = TimeLine.Normal,
            Action <float> onUpdate         = null,
            UnityAction onArriveAtEnding    = null,
            UnityAction onArriveAtBeginning = null)
        {
            TweenInterpolator interpolator = gameObject.AddComponent <TweenInterpolator>();

            interpolator.isPlaying = isPlaying;
            interpolator.delay     = delay;
            interpolator.duration  = duration;
            interpolator.speed     = speed;
            interpolator.method    = method;
            interpolator.wrapMode  = wrapMode;
            interpolator.timeLine  = timeLine;
            if (onUpdate != null)
            {
                interpolator.onTween += onUpdate;
            }
            if (onArriveAtEnding != null)
            {
                interpolator.onArriveAtEnding.AddListener(onArriveAtEnding);
            }
            if (onArriveAtBeginning != null)
            {
                interpolator.onArriveAtBeginning.AddListener(onArriveAtBeginning);
            }
            return(interpolator);
        }