コード例 #1
0
ファイル: LeanTween.cs プロジェクト: mhfirdausi/VGDSix
        // Tweening Functions - Thanks to Robert Penner and GFX47

        private static float tweenOnCurve(LTDescr tweenDescr, float ratioPassed)
        {
            // Debug.Log("single ratio:"+ratioPassed+" tweenDescr.animationCurve.Evaluate(ratioPassed):"+tweenDescr.animationCurve.Evaluate(ratioPassed));
            return tweenDescr.from.x + (tweenDescr.diff.x) * tweenDescr.animationCurve.Evaluate(ratioPassed);
        }
コード例 #2
0
ファイル: LeanTween.cs プロジェクト: mhfirdausi/VGDSix
 private static Vector3 tweenOnCurveVector(LTDescr tweenDescr, float ratioPassed)
 {
     return new Vector3(tweenDescr.from.x + (tweenDescr.diff.x) * tweenDescr.animationCurve.Evaluate(ratioPassed),
         tweenDescr.from.y + (tweenDescr.diff.y) * tweenDescr.animationCurve.Evaluate(ratioPassed),
         tweenDescr.from.z + (tweenDescr.diff.z) * tweenDescr.animationCurve.Evaluate(ratioPassed));
 }
コード例 #3
0
ファイル: LeanTween.cs プロジェクト: mhfirdausi/VGDSix
        /**
    * Move a GameObject through a set of points, in local space
    * 
    * @method LeanTween.moveSplineLocal
    * @param {GameObject} gameObject:GameObject Gameobject that you wish to move
    * @param {Vector3[]} path:Vector3[] A set of points that define the curve(s) ex: ControlStart,Pt1,Pt2,Pt3,.. ..ControlEnd
    * @param {float} time:float The time to complete the tween in
    * @return {LTDescr} LTDescr an object that distinguishes the tween
    * @example
    * <i>Javascript:</i><br>
    * LeanTween.moveSpline(gameObject, [Vector3(0,0,0),Vector3(1,0,0),Vector3(1,0,0),Vector3(1,0,1)], 2.0) .setEase(LeanTweenType.easeOutQuad).setOrientToPath(true);<br><br>
    * <i>C#:</i><br>
    * LeanTween.moveSpline(gameObject, new Vector3[]{new Vector3(0f,0f,0f),new Vector3(1f,0f,0f),new Vector3(1f,0f,0f),new Vector3(1f,0f,1f)}, 1.5f).setEase(LeanTweenType.easeOutQuad).setOrientToPath(true);<br>
    */

        public static LTDescr moveSplineLocal(GameObject gameObject, Vector3[] to, float time)
        {
            descr = options();
            descr.spline = new LTSpline(to);

            return pushNewTween(gameObject, new Vector3(1.0f, 0.0f, 0.0f), time, TweenAction.MOVE_SPLINE_LOCAL, descr);
        }
コード例 #4
0
ファイル: LeanTween.cs プロジェクト: mhfirdausi/VGDSix
        /**
    * Move a GameObject along a set of bezier curves, in local space
    * 
    * @method LeanTween.moveLocal
    * @param {GameObject} gameObject:GameObject Gameobject that you wish to move
    * @param {Vector3[]} path:Vector3[] A set of points that define the curve(s) ex: Point1,Handle1,Handle2,Point2,...
    * @param {float} time:float The time to complete the tween in
    * @return {LTDescr} LTDescr an object that distinguishes the tween
    * @example
    * <i>Javascript:</i><br>
    * LeanTween.move(gameObject, [Vector3(0,0,0),Vector3(1,0,0),Vector3(1,0,0),Vector3(1,0,1)], 2.0).setEase(LeanTweenType.easeOutQuad).setOrientToPath(true);<br><br>
    * <i>C#:</i><br>
    * LeanTween.move(gameObject, new Vector3[]{Vector3(0f,0f,0f),Vector3(1f,0f,0f),Vector3(1f,0f,0f),Vector3(1f,0f,1f)}).setEase(LeanTweenType.easeOutQuad).setOrientToPath(true);<br>
    */

        public static LTDescr moveLocal(GameObject gameObject, Vector3[] to, float time)
        {
            descr = options();
            if (descr.path == null)
                descr.path = new LTBezierPath(to);
            else
                descr.path.setPoints(to);

            return pushNewTween(gameObject, new Vector3(1.0f, 0.0f, 0.0f), time, TweenAction.MOVE_CURVED_LOCAL, descr);
        }
コード例 #5
0
ファイル: LeanTween.cs プロジェクト: mhfirdausi/VGDSix
        private static LTDescr pushNewTween(GameObject gameObject, Vector3 to, float time, TweenAction tweenAction,
            LTDescr tween)
        {
            init(maxTweens);
            if (gameObject == null || tween == null)
                return null;

            tween.trans = gameObject.transform;
            tween.to = to;
            tween.time = time;
            tween.type = tweenAction;
            //tween.hasPhysics = gameObject.rigidbody!=null;

            return tween;
        }
コード例 #6
0
ファイル: LeanTween.cs プロジェクト: mhfirdausi/VGDSix
        // LeanTween 2.0 Methods

        public static LTDescr options(LTDescr seed)
        {
            Debug.LogError("error this function is no longer used");
            return null;
        }
コード例 #7
0
ファイル: LeanTween.cs プロジェクト: mhfirdausi/VGDSix
 private static Color tweenColor(LTDescr tween, float val)
 {
     Vector3 diff3 = tween.point - tween.axis;
     float diffAlpha = tween.to.y - tween.from.y;
     return new Color(tween.axis.x + diff3.x * val, tween.axis.y + diff3.y * val, tween.axis.z + diff3.z * val,
         tween.from.y + diffAlpha * val);
 }
コード例 #8
0
ファイル: LeanTween.cs プロジェクト: mhfirdausi/VGDSix
        public static void update()
        {
            if (frameRendered != Time.frameCount)
            {
                // make sure update is only called once per frame
                init();

#if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5
		dtEstimated = Time.realtimeSinceStartup - previousRealTime;
		if(dtEstimated>0.2f) // a catch put in, when at the start sometimes this number can grow unrealistically large
			dtEstimated = 0.2f;
		previousRealTime = Time.realtimeSinceStartup;
#else
                dtEstimated = Time.unscaledDeltaTime;
#endif

                dtActual = Time.deltaTime;
                maxTweenReached = 0;
                finishedCnt = 0;
                // if(tweenMaxSearch>1500)
                // Debug.Log("tweenMaxSearch:"+tweenMaxSearch +" maxTweens:"+maxTweens);
                for (int i = 0; i <= tweenMaxSearch && i < maxTweens; i++)
                {

                    //Debug.Log("tweens["+i+"].toggle:"+tweens[i].toggle);
                    if (tweens[i].toggle)
                    {
                        maxTweenReached = i;
                        tween = tweens[i];
                        trans = tween.trans;
                        timeTotal = tween.time;
                        tweenAction = tween.type;

                        dt = dtActual;
                        if (tween.useEstimatedTime)
                        {
                            dt = dtEstimated;
                            timeTotal = tween.time;
                        }
                        else if (tween.useFrames)
                        {
                            dt = 1;
                        }
                        else if (tween.useManualTime)
                        {
                            dt = dtManual;
                        }
                        else if (tween.direction == 0f)
                        {
                            dt = 0f;
                        }

                        if (trans == null)
                        {
                            removeTween(i);
                            continue;
                        }
                        // Debug.Log("i:"+i+" tween:"+tween+" dt:"+dt);

                        // Check for tween finished
                        isTweenFinished = false;
                        if (tween.delay <= 0)
                        {
                            if ((tween.passed + dt > tween.time && tween.direction > 0.0f))
                            {
                                // Debug.Log("i:"+i+" passed:"+tween.passed+" dt:"+dt+" time:"+tween.time+" dir:"+tween.direction);
                                isTweenFinished = true;
                                tween.passed = tween.time;
                                // Set to the exact end time so that it can finish tween exactly on the end value
                            }
                            else if (tween.direction < 0.0f && tween.passed - dt < 0.0f)
                            {
                                isTweenFinished = true;
                                tween.passed = Mathf.Epsilon;
                            }
                        }

                        if (!tween.hasInitiliazed && ((tween.passed == 0.0 && tween.delay == 0.0) || tween.passed > 0.0))
                        {
                            tween.init();
                        }
                        if (tween.delay <= 0)
                        {
                            // Move Values
                            if (timeTotal <= 0f)
                            {
                                //Debug.LogError("time total is zero Time.timeScale:"+Time.timeScale+" useEstimatedTime:"+tween.useEstimatedTime);
                                ratioPassed = 0f;
                            }
                            else
                            {
                                ratioPassed = tween.passed / timeTotal;
                            }

                            if (ratioPassed > 1.0f)
                            {
                                ratioPassed = 1.0f;
                            }
                            else if (ratioPassed < 0f)
                            {
                                ratioPassed = 0f;
                            }
                            // Debug.Log("action:"+tweenAction+" ratioPassed:"+ratioPassed + " timeTotal:" + timeTotal + " tween.passed:"+ tween.passed +" dt:"+dt);

                            if (tweenAction >= TweenAction.MOVE_X && tweenAction < TweenAction.MOVE)
                            {
                                if (tween.animationCurve != null)
                                {
                                    val = tweenOnCurve(tween, ratioPassed);
                                }
                                else
                                {
                                    switch (tween.tweenType)
                                    {
                                        case LeanTweenType.linear:
                                            val = tween.from.x + tween.diff.x * ratioPassed;
                                            break;
                                        case LeanTweenType.easeOutQuad:
                                            val = easeOutQuadOpt(tween.from.x, tween.diff.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeInQuad:
                                            val = easeInQuadOpt(tween.from.x, tween.diff.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeInOutQuad:
                                            val = easeInOutQuadOpt(tween.from.x, tween.diff.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeInCubic:
                                            val = easeInCubic(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeOutCubic:
                                            val = easeOutCubic(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeInOutCubic:
                                            val = easeInOutCubic(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeInQuart:
                                            val = easeInQuart(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeOutQuart:
                                            val = easeOutQuart(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeInOutQuart:
                                            val = easeInOutQuart(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeInQuint:
                                            val = easeInQuint(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeOutQuint:
                                            val = easeOutQuint(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeInOutQuint:
                                            val = easeInOutQuint(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeInSine:
                                            val = easeInSine(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeOutSine:
                                            val = easeOutSine(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeInOutSine:
                                            val = easeInOutSine(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeInExpo:
                                            val = easeInExpo(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeOutExpo:
                                            val = easeOutExpo(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeInOutExpo:
                                            val = easeInOutExpo(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeInCirc:
                                            val = easeInCirc(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeOutCirc:
                                            val = easeOutCirc(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeInOutCirc:
                                            val = easeInOutCirc(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeInBounce:
                                            val = easeInBounce(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeOutBounce:
                                            val = easeOutBounce(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeInOutBounce:
                                            val = easeInOutBounce(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeInBack:
                                            val = easeInBack(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeOutBack:
                                            val = easeOutBack(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeInOutBack:
                                            val = easeInOutElastic(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeInElastic:
                                            val = easeInElastic(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeOutElastic:
                                            val = easeOutElastic(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.easeInOutElastic:
                                            val = easeInOutElastic(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        case LeanTweenType.punch:
                                        case LeanTweenType.easeShake:
                                            if (tween.tweenType == LeanTweenType.punch)
                                            {
                                                tween.animationCurve = LeanTween.punch;
                                            }
                                            else if (tween.tweenType == LeanTweenType.easeShake)
                                            {
                                                tween.animationCurve = LeanTween.shake;
                                            }
                                            tween.to.x = tween.from.x + tween.to.x;
                                            tween.diff.x = tween.to.x - tween.from.x;
                                            val = tweenOnCurve(tween, ratioPassed);
                                            break;
                                        case LeanTweenType.easeSpring:
                                            val = spring(tween.from.x, tween.to.x, ratioPassed);
                                            break;
                                        default:
                                            {
                                                val = tween.from.x + tween.diff.x * ratioPassed;
                                                break;
                                            }
                                    }

                                }

                                //Debug.Log("from:"+from+" to:"+to+" val:"+val+" ratioPassed:"+ratioPassed);
                                if (tweenAction == TweenAction.MOVE_X)
                                {
                                    trans.position = new Vector3(val, trans.position.y, trans.position.z);
                                }
                                else if (tweenAction == TweenAction.MOVE_Y)
                                {
                                    trans.position = new Vector3(trans.position.x, val, trans.position.z);
                                }
                                else if (tweenAction == TweenAction.MOVE_Z)
                                {
                                    trans.position = new Vector3(trans.position.x, trans.position.y, val);
                                }
                                if (tweenAction == TweenAction.MOVE_LOCAL_X)
                                {
                                    trans.localPosition = new Vector3(val, trans.localPosition.y, trans.localPosition.z);
                                }
                                else if (tweenAction == TweenAction.MOVE_LOCAL_Y)
                                {
                                    trans.localPosition = new Vector3(trans.localPosition.x, val, trans.localPosition.z);
                                }
                                else if (tweenAction == TweenAction.MOVE_LOCAL_Z)
                                {
                                    trans.localPosition = new Vector3(trans.localPosition.x, trans.localPosition.y, val);
                                }
                                else if (tweenAction == TweenAction.MOVE_CURVED)
                                {
                                    if (tween.path.orientToPath)
                                    {
                                        if (tween.path.orientToPath2d)
                                        {
                                            tween.path.place2d(trans, val);
                                        }
                                        else
                                        {
                                            tween.path.place(trans, val);
                                        }
                                    }
                                    else
                                    {
                                        trans.position = tween.path.point(val);
                                    }
                                    // Debug.Log("val:"+val+" trans.position:"+trans.position + " 0:"+ tween.curves[0] +" 1:"+tween.curves[1] +" 2:"+tween.curves[2] +" 3:"+tween.curves[3]);
                                }
                                else if ((TweenAction)tweenAction == TweenAction.MOVE_CURVED_LOCAL)
                                {
                                    if (tween.path.orientToPath)
                                    {
                                        if (tween.path.orientToPath2d)
                                        {
                                            tween.path.placeLocal2d(trans, val);
                                        }
                                        else
                                        {
                                            tween.path.placeLocal(trans, val);
                                        }
                                    }
                                    else
                                    {
                                        trans.localPosition = tween.path.point(val);
                                    }
                                    // Debug.Log("val:"+val+" trans.position:"+trans.position);
                                }
                                else if (tweenAction == TweenAction.MOVE_SPLINE)
                                {
                                    if (tween.spline.orientToPath)
                                    {
                                        if (tween.spline.orientToPath2d)
                                        {
                                            tween.spline.place2d(trans, val);
                                        }
                                        else
                                        {
                                            tween.spline.place(trans, val);
                                        }
                                    }
                                    else
                                    {
                                        trans.position = tween.spline.point(val);
                                    }
                                }
                                else if (tweenAction == TweenAction.MOVE_SPLINE_LOCAL)
                                {
                                    if (tween.spline.orientToPath)
                                    {
                                        if (tween.spline.orientToPath2d)
                                        {
                                            tween.spline.placeLocal2d(trans, val);
                                        }
                                        else
                                        {
                                            tween.spline.placeLocal(trans, val);
                                        }
                                    }
                                    else
                                    {
                                        trans.localPosition = tween.spline.point(val);
                                    }
                                }
                                else if (tweenAction == TweenAction.SCALE_X)
                                {
                                    trans.localScale = new Vector3(val, trans.localScale.y, trans.localScale.z);
                                }
                                else if (tweenAction == TweenAction.SCALE_Y)
                                {
                                    trans.localScale = new Vector3(trans.localScale.x, val, trans.localScale.z);
                                }
                                else if (tweenAction == TweenAction.SCALE_Z)
                                {
                                    trans.localScale = new Vector3(trans.localScale.x, trans.localScale.y, val);
                                }
                                else if (tweenAction == TweenAction.ROTATE_X)
                                {
                                    trans.eulerAngles = new Vector3(val, trans.eulerAngles.y, trans.eulerAngles.z);
                                }
                                else if (tweenAction == TweenAction.ROTATE_Y)
                                {
                                    trans.eulerAngles = new Vector3(trans.eulerAngles.x, val, trans.eulerAngles.z);
                                }
                                else if (tweenAction == TweenAction.ROTATE_Z)
                                {
                                    trans.eulerAngles = new Vector3(trans.eulerAngles.x, trans.eulerAngles.y, val);
                                }
                                else if (tweenAction == TweenAction.ROTATE_AROUND)
                                {
                                    Vector3 origPos = trans.localPosition;
                                    Vector3 rotateAroundPt = (Vector3)trans.TransformPoint(tween.point);
                                    trans.RotateAround(rotateAroundPt, tween.axis, -val);
                                    Vector3 diff = origPos - trans.localPosition;

                                    trans.localPosition = origPos - diff;
                                    // Subtract the amount the object has been shifted over by the rotate, to get it back to it's orginal position
                                    trans.rotation = tween.origRotation;

                                    rotateAroundPt = (Vector3)trans.TransformPoint(tween.point);
                                    trans.RotateAround(rotateAroundPt, tween.axis, val);

                                    //GameObject cubeMarker = GameObject.Find("TweenRotatePoint");
                                    //cubeMarker.transform.position = rotateAroundPt;

                                }
                                else if (tweenAction == TweenAction.ROTATE_AROUND_LOCAL)
                                {
                                    Vector3 origPos = trans.localPosition;
                                    trans.RotateAround((Vector3)trans.TransformPoint(tween.point),
                                        trans.TransformDirection(tween.axis), -val);
                                    Vector3 diff = origPos - trans.localPosition;

                                    trans.localPosition = origPos - diff;
                                    // Subtract the amount the object has been shifted over by the rotate, to get it back to it's orginal position
                                    trans.localRotation = tween.origRotation;
                                    Vector3 rotateAroundPt = (Vector3)trans.TransformPoint(tween.point);
                                    trans.RotateAround(rotateAroundPt, trans.TransformDirection(tween.axis), val);

                                    //GameObject cubeMarker = GameObject.Find("TweenRotatePoint");
                                    //cubeMarker.transform.position = rotateAroundPt;

                                }
                                else if (tweenAction == TweenAction.ALPHA)
                                {
#if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2

					    	if(trans.gameObject.renderer){
								foreach(Material mat in trans.gameObject.renderer.materials){
	        						mat.color = new Color( mat.color.r, mat.color.g, mat.color.b, val);
	    						}
							}
							if(trans.childCount>0){
								foreach (Transform child in trans) {
									if(child.gameObject.renderer!=null){
										foreach(Material mat in child.gameObject.renderer.materials){
			        						mat.color = new Color( mat.color.r, mat.color.g, mat.color.b, val);
			    						}
			    					}
								}
							}

#else

                                    SpriteRenderer ren = trans.gameObject.GetComponent<SpriteRenderer>();

                                    if (ren != null)
                                    {
                                        ren.color = new Color(ren.color.r, ren.color.g, ren.color.b, val);
                                    }
                                    else
                                    {
                                        if (trans.gameObject.GetComponent<Renderer>() != null)
                                        {
                                            foreach (Material mat in trans.gameObject.GetComponent<Renderer>().materials
                                                )
                                            {
                                                if (mat.HasProperty("_Color"))
                                                {
                                                    mat.color = new Color(mat.color.r, mat.color.g, mat.color.b, val);
                                                }
                                                else if (mat.HasProperty("_TintColor"))
                                                {
                                                    Color col = mat.GetColor("_TintColor");
                                                    mat.SetColor("_TintColor", new Color(col.r, col.g, col.b, val));
                                                }
                                            }
                                        }
                                        if (trans.childCount > 0)
                                        {
                                            foreach (Transform child in trans)
                                            {
                                                if (child.gameObject.GetComponent<Renderer>() != null)
                                                {
                                                    foreach (
                                                        Material mat in
                                                            child.gameObject.GetComponent<Renderer>().materials)
                                                    {
                                                        mat.color = new Color(mat.color.r, mat.color.g, mat.color.b, val);
                                                    }
                                                }
                                            }
                                        }
                                    }

#endif
                                }
                                else if (tweenAction == TweenAction.ALPHA_VERTEX)
                                {
                                    Mesh mesh = trans.GetComponent<MeshFilter>().mesh;
                                    Vector3[] vertices = mesh.vertices;
                                    Color32[] colors = new Color32[vertices.Length];
                                    Color32 c = mesh.colors32[0];
                                    c = new Color(c.r, c.g, c.b, val);
                                    for (int k = 0; k < vertices.Length; k++)
                                    {
                                        colors[k] = c;
                                    }
                                    mesh.colors32 = colors;
                                }
                                else if (tweenAction == TweenAction.COLOR || tweenAction == TweenAction.CALLBACK_COLOR)
                                {
                                    Color toColor = tweenColor(tween, val);
                                    // Debug.Log("val:"+val+" tween:"+tween+" tween.diff:"+tween.diff);
                                    if (tweenAction == TweenAction.COLOR)
                                    {
                                        if (trans.gameObject.GetComponent<Renderer>() != null)
                                        {
                                            foreach (Material mat in trans.gameObject.GetComponent<Renderer>().materials
                                                )
                                            {
                                                mat.color = toColor;
                                            }
                                        }
                                        if (trans.childCount > 0)
                                        {
                                            foreach (Transform child in trans)
                                            {
                                                if (child.gameObject.GetComponent<Renderer>() != null)
                                                {
                                                    foreach (
                                                        Material mat in
                                                            child.gameObject.GetComponent<Renderer>().materials)
                                                    {
                                                        mat.color = toColor;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    if (tween.onUpdateColor != null)
                                    {
                                        tween.onUpdateColor(toColor);
                                    }
                                }
#if !UNITY_3_5 && !UNITY_4_0 && !UNITY_4_0_1 && !UNITY_4_1 && !UNITY_4_2 && !UNITY_4_3 && !UNITY_4_5
                                else if (tweenAction == TweenAction.CANVAS_ALPHA)
                                {
                                    Color c = tween.uiImage.color;
                                    c.a = val;
                                    tween.uiImage.color = c;
                                }
                                else if (tweenAction == TweenAction.CANVAS_COLOR)
                                {
                                    Color toColor = tweenColor(tween, val);
                                    tween.uiImage.color = toColor;
                                    if (tween.onUpdateColor != null)
                                    {
                                        tween.onUpdateColor(toColor);
                                    }
                                }
                                else if (tweenAction == TweenAction.TEXT_ALPHA)
                                {
                                    textAlphaRecursive(trans, val);
                                }
                                else if (tweenAction == TweenAction.TEXT_COLOR)
                                {
                                    Color toColor = tweenColor(tween, val);
                                    tween.uiText.color = toColor;
                                    if (tween.onUpdateColor != null)
                                    {
                                        tween.onUpdateColor(toColor);
                                    }
                                    if (trans.childCount > 0)
                                    {
                                        foreach (Transform child in trans)
                                        {
                                            UnityEngine.UI.Text uiText =
                                                child.gameObject.GetComponent<UnityEngine.UI.Text>();
                                            if (uiText != null)
                                            {
                                                uiText.color = toColor;
                                            }
                                        }
                                    }
                                }
                                else if (tweenAction == TweenAction.CANVAS_ROTATEAROUND)
                                {
                                    // figure out how much the rotation has shifted the object over
                                    RectTransform rect = tween.rectTransform;
                                    Vector3 origPos = rect.localPosition;
                                    rect.RotateAround((Vector3)rect.TransformPoint(tween.point), tween.axis, -val);
                                    Vector3 diff = origPos - rect.localPosition;

                                    rect.localPosition = origPos - diff;
                                    // Subtract the amount the object has been shifted over by the rotate, to get it back to it's orginal position
                                    rect.rotation = tween.origRotation;
                                    rect.RotateAround((Vector3)rect.TransformPoint(tween.point), tween.axis, val);
                                }
                                else if (tweenAction == TweenAction.CANVAS_ROTATEAROUND_LOCAL)
                                {
                                    // figure out how much the rotation has shifted the object over
                                    RectTransform rect = tween.rectTransform;
                                    Vector3 origPos = rect.localPosition;
                                    rect.RotateAround((Vector3)rect.TransformPoint(tween.point),
                                        rect.TransformDirection(tween.axis), -val);
                                    Vector3 diff = origPos - rect.localPosition;

                                    rect.localPosition = origPos - diff;
                                    // Subtract the amount the object has been shifted over by the rotate, to get it back to it's orginal position
                                    rect.rotation = tween.origRotation;
                                    rect.RotateAround((Vector3)rect.TransformPoint(tween.point),
                                        rect.TransformDirection(tween.axis), val);
                                }
                                else if (tweenAction == TweenAction.CANVAS_PLAYSPRITE)
                                {
                                    int frame = (int)Mathf.Round(val);
                                    // Debug.Log("frame:"+frame+" val:"+val);
                                    tween.uiImage.sprite = tween.sprites[frame];
                                }
#endif

                            }
                            else if (tweenAction >= TweenAction.MOVE)
                            {
                                //

                                if (tween.animationCurve != null)
                                {
                                    newVect = tweenOnCurveVector(tween, ratioPassed);
                                }
                                else
                                {
                                    if (tween.tweenType == LeanTweenType.linear)
                                    {
                                        newVect = new Vector3(tween.from.x + tween.diff.x * ratioPassed,
                                            tween.from.y + tween.diff.y * ratioPassed,
                                            tween.from.z + tween.diff.z * ratioPassed);
                                    }
                                    else if (tween.tweenType >= LeanTweenType.linear)
                                    {
                                        switch (tween.tweenType)
                                        {
                                            case LeanTweenType.easeOutQuad:
                                                newVect =
                                                    new Vector3(
                                                        easeOutQuadOpt(tween.from.x, tween.diff.x, ratioPassed),
                                                        easeOutQuadOpt(tween.from.y, tween.diff.y, ratioPassed),
                                                        easeOutQuadOpt(tween.from.z, tween.diff.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeInQuad:
                                                newVect =
                                                    new Vector3(easeInQuadOpt(tween.from.x, tween.diff.x, ratioPassed),
                                                        easeInQuadOpt(tween.from.y, tween.diff.y, ratioPassed),
                                                        easeInQuadOpt(tween.from.z, tween.diff.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeInOutQuad:
                                                newVect =
                                                    new Vector3(
                                                        easeInOutQuadOpt(tween.from.x, tween.diff.x, ratioPassed),
                                                        easeInOutQuadOpt(tween.from.y, tween.diff.y, ratioPassed),
                                                        easeInOutQuadOpt(tween.from.z, tween.diff.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeInCubic:
                                                newVect = new Vector3(
                                                    easeInCubic(tween.from.x, tween.to.x, ratioPassed),
                                                    easeInCubic(tween.from.y, tween.to.y, ratioPassed),
                                                    easeInCubic(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeOutCubic:
                                                newVect =
                                                    new Vector3(easeOutCubic(tween.from.x, tween.to.x, ratioPassed),
                                                        easeOutCubic(tween.from.y, tween.to.y, ratioPassed),
                                                        easeOutCubic(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeInOutCubic:
                                                newVect =
                                                    new Vector3(easeInOutCubic(tween.from.x, tween.to.x, ratioPassed),
                                                        easeInOutCubic(tween.from.y, tween.to.y, ratioPassed),
                                                        easeInOutCubic(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeInQuart:
                                                newVect = new Vector3(
                                                    easeInQuart(tween.from.x, tween.to.x, ratioPassed),
                                                    easeInQuart(tween.from.y, tween.to.y, ratioPassed),
                                                    easeInQuart(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeOutQuart:
                                                newVect =
                                                    new Vector3(easeOutQuart(tween.from.x, tween.to.x, ratioPassed),
                                                        easeOutQuart(tween.from.y, tween.to.y, ratioPassed),
                                                        easeOutQuart(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeInOutQuart:
                                                newVect =
                                                    new Vector3(easeInOutQuart(tween.from.x, tween.to.x, ratioPassed),
                                                        easeInOutQuart(tween.from.y, tween.to.y, ratioPassed),
                                                        easeInOutQuart(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeInQuint:
                                                newVect = new Vector3(
                                                    easeInQuint(tween.from.x, tween.to.x, ratioPassed),
                                                    easeInQuint(tween.from.y, tween.to.y, ratioPassed),
                                                    easeInQuint(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeOutQuint:
                                                newVect =
                                                    new Vector3(easeOutQuint(tween.from.x, tween.to.x, ratioPassed),
                                                        easeOutQuint(tween.from.y, tween.to.y, ratioPassed),
                                                        easeOutQuint(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeInOutQuint:
                                                newVect =
                                                    new Vector3(easeInOutQuint(tween.from.x, tween.to.x, ratioPassed),
                                                        easeInOutQuint(tween.from.y, tween.to.y, ratioPassed),
                                                        easeInOutQuint(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeInSine:
                                                newVect = new Vector3(
                                                    easeInSine(tween.from.x, tween.to.x, ratioPassed),
                                                    easeInSine(tween.from.y, tween.to.y, ratioPassed),
                                                    easeInSine(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeOutSine:
                                                newVect = new Vector3(
                                                    easeOutSine(tween.from.x, tween.to.x, ratioPassed),
                                                    easeOutSine(tween.from.y, tween.to.y, ratioPassed),
                                                    easeOutSine(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeInOutSine:
                                                newVect =
                                                    new Vector3(easeInOutSine(tween.from.x, tween.to.x, ratioPassed),
                                                        easeInOutSine(tween.from.y, tween.to.y, ratioPassed),
                                                        easeInOutSine(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeInExpo:
                                                newVect = new Vector3(
                                                    easeInExpo(tween.from.x, tween.to.x, ratioPassed),
                                                    easeInExpo(tween.from.y, tween.to.y, ratioPassed),
                                                    easeInExpo(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeOutExpo:
                                                newVect = new Vector3(
                                                    easeOutExpo(tween.from.x, tween.to.x, ratioPassed),
                                                    easeOutExpo(tween.from.y, tween.to.y, ratioPassed),
                                                    easeOutExpo(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeInOutExpo:
                                                newVect =
                                                    new Vector3(easeInOutExpo(tween.from.x, tween.to.x, ratioPassed),
                                                        easeInOutExpo(tween.from.y, tween.to.y, ratioPassed),
                                                        easeInOutExpo(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeInCirc:
                                                newVect = new Vector3(
                                                    easeInCirc(tween.from.x, tween.to.x, ratioPassed),
                                                    easeInCirc(tween.from.y, tween.to.y, ratioPassed),
                                                    easeInCirc(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeOutCirc:
                                                newVect = new Vector3(
                                                    easeOutCirc(tween.from.x, tween.to.x, ratioPassed),
                                                    easeOutCirc(tween.from.y, tween.to.y, ratioPassed),
                                                    easeOutCirc(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeInOutCirc:
                                                newVect =
                                                    new Vector3(easeInOutCirc(tween.from.x, tween.to.x, ratioPassed),
                                                        easeInOutCirc(tween.from.y, tween.to.y, ratioPassed),
                                                        easeInOutCirc(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeInBounce:
                                                newVect =
                                                    new Vector3(easeInBounce(tween.from.x, tween.to.x, ratioPassed),
                                                        easeInBounce(tween.from.y, tween.to.y, ratioPassed),
                                                        easeInBounce(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeOutBounce:
                                                newVect =
                                                    new Vector3(easeOutBounce(tween.from.x, tween.to.x, ratioPassed),
                                                        easeOutBounce(tween.from.y, tween.to.y, ratioPassed),
                                                        easeOutBounce(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeInOutBounce:
                                                newVect =
                                                    new Vector3(easeInOutBounce(tween.from.x, tween.to.x, ratioPassed),
                                                        easeInOutBounce(tween.from.y, tween.to.y, ratioPassed),
                                                        easeInOutBounce(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeInBack:
                                                newVect = new Vector3(
                                                    easeInBack(tween.from.x, tween.to.x, ratioPassed),
                                                    easeInBack(tween.from.y, tween.to.y, ratioPassed),
                                                    easeInBack(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeOutBack:
                                                newVect = new Vector3(
                                                    easeOutBack(tween.from.x, tween.to.x, ratioPassed),
                                                    easeOutBack(tween.from.y, tween.to.y, ratioPassed),
                                                    easeOutBack(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeInOutBack:
                                                newVect =
                                                    new Vector3(easeInOutBack(tween.from.x, tween.to.x, ratioPassed),
                                                        easeInOutBack(tween.from.y, tween.to.y, ratioPassed),
                                                        easeInOutBack(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeInElastic:
                                                newVect =
                                                    new Vector3(easeInElastic(tween.from.x, tween.to.x, ratioPassed),
                                                        easeInElastic(tween.from.y, tween.to.y, ratioPassed),
                                                        easeInElastic(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeOutElastic:
                                                newVect =
                                                    new Vector3(easeOutElastic(tween.from.x, tween.to.x, ratioPassed),
                                                        easeOutElastic(tween.from.y, tween.to.y, ratioPassed),
                                                        easeOutElastic(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.easeInOutElastic:
                                                newVect =
                                                    new Vector3(
                                                        easeInOutElastic(tween.from.x, tween.to.x, ratioPassed),
                                                        easeInOutElastic(tween.from.y, tween.to.y, ratioPassed),
                                                        easeInOutElastic(tween.from.z, tween.to.z, ratioPassed));
                                                break;
                                            case LeanTweenType.punch:
                                            case LeanTweenType.easeShake:
                                                if (tween.tweenType == LeanTweenType.punch)
                                                {
                                                    tween.animationCurve = LeanTween.punch;
                                                }
                                                else if (tween.tweenType == LeanTweenType.easeShake)
                                                {
                                                    tween.animationCurve = LeanTween.shake;
                                                }
                                                tween.to = tween.from + tween.to;
                                                tween.diff = tween.to - tween.from;
                                                if (tweenAction == TweenAction.ROTATE ||
                                                    tweenAction == TweenAction.ROTATE_LOCAL)
                                                {
                                                    tween.to = new Vector3(closestRot(tween.from.x, tween.to.x),
                                                        closestRot(tween.from.y, tween.to.y),
                                                        closestRot(tween.from.z, tween.to.z));
                                                }
                                                newVect = tweenOnCurveVector(tween, ratioPassed);
                                                break;
                                            case LeanTweenType.easeSpring:
                                                newVect = new Vector3(spring(tween.from.x, tween.to.x, ratioPassed),
                                                    spring(tween.from.y, tween.to.y, ratioPassed),
                                                    spring(tween.from.z, tween.to.z, ratioPassed));
                                                break;

                                        }
                                    }
                                    else
                                    {
                                        newVect = new Vector3(tween.from.x + tween.diff.x * ratioPassed,
                                            tween.from.y + tween.diff.y * ratioPassed,
                                            tween.from.z + tween.diff.z * ratioPassed);
                                    }
                                }

                                if (tweenAction == TweenAction.MOVE)
                                {
                                    trans.position = newVect;
                                }
                                else if (tweenAction == TweenAction.MOVE_LOCAL)
                                {
                                    trans.localPosition = newVect;
                                }
                                else if (tweenAction == TweenAction.ROTATE)
                                {
                                    /*if(tween.hasPhysics){
                                    trans.gameObject.rigidbody.MoveRotation(Quaternion.Euler( newVect ));
                                }else{*/
                                    trans.eulerAngles = newVect;
                                    // }
                                }
                                else if (tweenAction == TweenAction.ROTATE_LOCAL)
                                {
                                    trans.localEulerAngles = newVect;
                                }
                                else if (tweenAction == TweenAction.SCALE)
                                {
                                    trans.localScale = newVect;
                                }
                                else if (tweenAction == TweenAction.GUI_MOVE)
                                {
                                    tween.ltRect.rect = new Rect(newVect.x, newVect.y, tween.ltRect.rect.width,
                                        tween.ltRect.rect.height);
                                }
                                else if (tweenAction == TweenAction.GUI_MOVE_MARGIN)
                                {
                                    tween.ltRect.margin = new Vector2(newVect.x, newVect.y);
                                }
                                else if (tweenAction == TweenAction.GUI_SCALE)
                                {
                                    tween.ltRect.rect = new Rect(tween.ltRect.rect.x, tween.ltRect.rect.y, newVect.x,
                                        newVect.y);
                                }
                                else if (tweenAction == TweenAction.GUI_ALPHA)
                                {
                                    tween.ltRect.alpha = newVect.x;
                                }
                                else if (tweenAction == TweenAction.GUI_ROTATE)
                                {
                                    tween.ltRect.rotation = newVect.x;
                                }
#if !UNITY_3_5 && !UNITY_4_0 && !UNITY_4_0_1 && !UNITY_4_1 && !UNITY_4_2 && !UNITY_4_3 && !UNITY_4_5
                                else if (tweenAction == TweenAction.CANVAS_MOVE)
                                {
                                    tween.rectTransform.anchoredPosition3D = newVect;
                                }
                                else if (tweenAction == TweenAction.CANVAS_SCALE)
                                {
                                    tween.rectTransform.localScale = newVect;
                                }
#endif
                            }
                            // Debug.Log("tween.delay:"+tween.delay + " tween.passed:"+tween.passed + " tweenAction:"+tweenAction + " to:"+newVect+" axis:"+tween.axis);

                            if (tween.hasUpdateCallback)
                            {
                                if (tween.onUpdateFloat != null)
                                {
                                    tween.onUpdateFloat(val);
                                }
                                if (tween.onUpdateFloatRatio != null)
                                {
                                    tween.onUpdateFloatRatio(val, ratioPassed);
                                }
                                else if (tween.onUpdateFloatObject != null)
                                {
                                    tween.onUpdateFloatObject(val, tween.onUpdateParam);
                                }
                                else if (tween.onUpdateVector3Object != null)
                                {
                                    tween.onUpdateVector3Object(newVect, tween.onUpdateParam);
                                }
                                else if (tween.onUpdateVector3 != null)
                                {
                                    tween.onUpdateVector3(newVect);
                                }
                                else if (tween.onUpdateVector2 != null)
                                {
                                    tween.onUpdateVector2(new Vector2(newVect.x, newVect.y));
                                }
                            }
#if LEANTWEEN_1
					else if(tween.optional!=null){ // LeanTween 1.x legacy stuff
						var onUpdate = tween.optional["onUpdate"];
						if(onUpdate!=null){
							Hashtable updateParam = (Hashtable)tween.optional["onUpdateParam"];
							if((TweenAction)tweenAction==TweenAction.VALUE3){
								if(onUpdate.GetType() == typeof(string)){
									string onUpdateS = onUpdate as string;
									customTarget = tween.optional["onUpdateTarget"]!=null ? tween.optional["onUpdateTarget"] as GameObject : trans.gameObject;
									customTarget.BroadcastMessage( onUpdateS, newVect );
								}else if(onUpdate.GetType() == typeof(System.Action<Vector3, Hashtable>)){
									System.Action<Vector3, Hashtable> onUpdateA = (System.Action<Vector3, Hashtable>)onUpdate;
									onUpdateA(newVect, updateParam);
								}else{
									System.Action<Vector3> onUpdateA = (System.Action<Vector3>)onUpdate;
									onUpdateA(newVect);
								}
							}else{
								if(onUpdate.GetType() == typeof(string)){
									string onUpdateS = onUpdate as string;
									if (tween.optional["onUpdateTarget"]!=null){
										customTarget = tween.optional["onUpdateTarget"] as GameObject;
										customTarget.BroadcastMessage( onUpdateS, val );
									}else{
										trans.gameObject.BroadcastMessage( onUpdateS, val );
									}
								}else if(onUpdate.GetType() == typeof(System.Action<float, Hashtable>)){
									System.Action<float, Hashtable> onUpdateA = (System.Action<float, Hashtable>)onUpdate;
									onUpdateA(val, updateParam);
								}else if(onUpdate.GetType() == typeof(System.Action<Vector3>)){
									System.Action<Vector3> onUpdateA = (System.Action<Vector3>)onUpdate;
									onUpdateA( newVect );
								}else{
									System.Action<float> onUpdateA = (System.Action<float>)onUpdate;
									onUpdateA(val);
								}
							}
						}
					}
#endif
                        }

                        if (isTweenFinished)
                        {
                            if (tween.loopType == LeanTweenType.once || tween.loopCount == 1)
                            {
                                tweensFinished[finishedCnt] = i;
                                finishedCnt++;

                                // Debug.Log("finished tween:"+i+" tween:"+tween);
                                if (tweenAction == TweenAction.GUI_ROTATE)
                                    tween.ltRect.rotateFinished = true;

                                if (tweenAction == TweenAction.DELAYED_SOUND)
                                {
                                    AudioSource.PlayClipAtPoint((AudioClip)tween.onCompleteParam, tween.to,
                                        tween.from.x);
                                }
                            }
                            else
                            {
                                if ((tween.loopCount < 0 && tween.type == TweenAction.CALLBACK) ||
                                    tween.onCompleteOnRepeat)
                                {
                                    if (tweenAction == TweenAction.DELAYED_SOUND)
                                    {
                                        AudioSource.PlayClipAtPoint((AudioClip)tween.onCompleteParam, tween.to,
                                            tween.from.x);
                                    }
                                    if (tween.onComplete != null)
                                    {
                                        tween.onComplete();
                                    }
                                    else if (tween.onCompleteObject != null)
                                    {
                                        tween.onCompleteObject(tween.onCompleteParam);
                                    }
                                }
                                if (tween.loopCount >= 1)
                                {
                                    tween.loopCount--;
                                }
                                // Debug.Log("tween.loopType:"+tween.loopType+" tween.loopCount:"+tween.loopCount+" passed:"+tween.passed);
                                if (tween.loopType == LeanTweenType.pingPong)
                                {
                                    tween.direction = 0.0f - (tween.direction);
                                }
                                else
                                {
                                    tween.passed = Mathf.Epsilon;
                                }
                            }
                        }
                        else if (tween.delay <= 0)
                        {
                            tween.passed += dt * tween.direction;
                        }
                        else
                        {
                            tween.delay -= dt;
                            // Debug.Log("dt:"+dt+" tween:"+i+" tween:"+tween);
                            if (tween.delay < 0)
                            {
                                tween.passed = 0.0f; //-tween.delay
                                tween.delay = 0.0f;
                            }
                        }
                    }
                }

                // Debug.Log("maxTweenReached:"+maxTweenReached);
                tweenMaxSearch = maxTweenReached;
                frameRendered = Time.frameCount;

                for (int i = 0; i < finishedCnt; i++)
                {
                    j = tweensFinished[i];
                    tween = tweens[j];

                    if (tween.onComplete != null)
                    {
                        System.Action onComplete = tween.onComplete;
                        removeTween(j);
                        //tween.cleanup();
                        onComplete();

                    }
                    else if (tween.onCompleteObject != null)
                    {
                        System.Action<object> onCompleteObject = tween.onCompleteObject;
                        object onCompleteParam = tween.onCompleteParam;
                        removeTween(j);
                        //tween.cleanup();
                        onCompleteObject(onCompleteParam);
                    }
#if LEANTWEEN_1
			else if(tween.optional!=null){
				System.Action callback=null;
				System.Action<object> callbackWithParam = null;
				string callbackS=string.Empty;
				object callbackParam=null;
				Hashtable optional = tween.optional;
				if(tween.optional!=null && tween.trans){
					if(tween.optional["onComplete"]!=null){
						callbackParam = tween.optional["onCompleteParam"];
						if(tween.optional["onComplete"].GetType()==typeof(string)){
							callbackS = tween.optional["onComplete"] as string;
						}else{
							if(callbackParam!=null){
								callbackWithParam = (System.Action<object>)tween.optional["onComplete"];
							}else{
								callback = (System.Action)tween.optional["onComplete"];	
								if(callback==null)
									Debug.LogWarning("callback was not converted");
							}
						}
					}
				}
				removeTween(j);
				if(callbackWithParam!=null){
					callbackWithParam( callbackParam );
				}else if(callback!=null){
					callback();
				}else if(callbackS!=string.Empty){
					if (optional["onCompleteTarget"]!=null){
						customTarget = optional["onCompleteTarget"] as GameObject;
						if(callbackParam!=null) customTarget.BroadcastMessage ( callbackS, callbackParam );
						else customTarget.BroadcastMessage( callbackS );
					}else{
						if(callbackParam!=null) trans.gameObject.BroadcastMessage ( callbackS, callbackParam );
						else trans.gameObject.BroadcastMessage( callbackS );
					}
				}
				
			}
#endif
                    else
                    {
                        removeTween(j);
                        //tween.cleanup();
                    }
                }

            }
        }
コード例 #9
0
ファイル: LeanTween.cs プロジェクト: mhfirdausi/VGDSix
        /**
    * This line is optional. Here you can specify the maximum number of tweens you will use (the default is 400).  This must be called before any use of LeanTween is made for it to be effective.
    * 
    * @method LeanTween.init
    * @param {integer} maxSimultaneousTweens:int The maximum number of tweens you will use, make sure you don't go over this limit, otherwise the code will throw an error
    * @example
    *   LeanTween.init( 800 );
    */

        public static void init(int maxSimultaneousTweens)
        {
            if (tweens == null)
            {
                maxTweens = maxSimultaneousTweens;
                tweens = new LTDescr[maxTweens];
                tweensFinished = new int[maxTweens];
                _tweenEmpty = new GameObject();
                _tweenEmpty.name = "~LeanTween";
                _tweenEmpty.AddComponent(typeof(LeanTween));
                _tweenEmpty.isStatic = true;
#if !UNITY_EDITOR
		_tweenEmpty.hideFlags = HideFlags.HideAndDontSave;
#endif
                DontDestroyOnLoad(_tweenEmpty);
                for (int i = 0; i < maxTweens; i++)
                {
                    tweens[i] = new LTDescr();
                }
            }
        }