Exemple #1
0
 public void BeginTweenFloat(float duration, float fromValue, float toValue, ChangeValueDelegate changeValueDelegate, FinishCallBackDelegate finishCallBack, bool destroyObjWhenFinish)
 {
     DestroyObjWhenFinish  = destroyObjWhenFinish;
     m_addNumber           = (toValue - fromValue) / duration;
     m_fromValue           = fromValue;
     m_toValue             = toValue;
     m_ChangeValueDelegate = changeValueDelegate;
     IsAdd            = fromValue < toValue;
     m_FinishCallBack = finishCallBack;
 }
    public void FlyToPos(Vector3 pos,FinishCallBackDelegate finishCallBack,object obj)
    {
        this.FinishCallBack = finishCallBack;
        this.callBackValue = obj;

        transform.localPosition = pos;
        OnFlyToTargetComplete ();
        return;
        isFly = true;
        flyTime = 0;
        fromPos = transform.localPosition;
        toPos = pos;
    }
Exemple #3
0
 public static GameObject Begin(float duration,float fromValue,float toValue,ChangeValueDelegate changeValueDelegate,FinishCallBackDelegate finishCallBack)
 {
     if(fromValue == toValue)
     {
         if(changeValueDelegate!=null)
         {
             changeValueDelegate(toValue);
         }
         if(finishCallBack!=null)
         {
             finishCallBack();
         }
         return null;
     }
     GameObject tweenObj = new GameObject();
     TweenFloat tweeenFloatComponent = tweenObj.AddComponent<TweenFloat>();
     tweeenFloatComponent.m_addNumber =(toValue - fromValue)/duration;
     tweeenFloatComponent.m_fromValue = fromValue;
     tweeenFloatComponent.m_toValue = toValue;
     tweeenFloatComponent.m_ChangeValueDelegate = changeValueDelegate;
     tweeenFloatComponent.IsAdd = fromValue<toValue;
     tweeenFloatComponent.m_FinishCallBack = finishCallBack;
     return tweenObj;
 }
Exemple #4
0
    public static TweenFloat Begin(GameObject obj, float duration, float fromValue, float toValue, ChangeValueDelegate changeValueDelegate, FinishCallBackDelegate finishCallBack, bool destroyObjWhenFinish = true)
    {
        if (fromValue == toValue)
        {
            if (changeValueDelegate != null)
            {
                changeValueDelegate(toValue);
            }
            if (finishCallBack != null)
            {
                finishCallBack();
            }
            return(null);
        }
        GameObject tweenObj            = obj;
        TweenFloat tweenFloatComponent = tweenObj.AddComponent <TweenFloat>();

        tweenFloatComponent.BeginTweenFloat(duration, fromValue, toValue, changeValueDelegate, finishCallBack, destroyObjWhenFinish);
        return(tweenFloatComponent);
    }
Exemple #5
0
/// <summary>
/// 开始计数
/// </summary>
/// <param name="duration">计数所需时间</param>
/// <param name="fromValue">开始数值</param>
/// <param name="toValue">目标数值</param>
/// <param name="changeValueDelegate">设置数值回调,每帧都会回调</param>
/// <param name="finishCallBack">完成计数回调</param>
    public static GameObject Begin(float duration, float fromValue, float toValue, ChangeValueDelegate changeValueDelegate, FinishCallBackDelegate finishCallBack, bool destroyObjWhenFinish = true)
    {
        if (fromValue == toValue)
        {
            if (changeValueDelegate != null)
            {
                changeValueDelegate(toValue);
            }
            if (finishCallBack != null)
            {
                finishCallBack();
            }
            return(null);
        }
        GameObject tweenObj = new GameObject("TweenFloat");

        Begin(tweenObj, duration, fromValue, toValue, changeValueDelegate, finishCallBack, destroyObjWhenFinish);
        return(tweenObj);
    }