onComplete() public method

sets the onComplete handler for the Tween
public onComplete ( Action onComplete ) : GoTweenConfig,
onComplete Action
return GoTweenConfig,
コード例 #1
0
    private IEnumerator Spawn(bool initial)
    {
        if (!initial)
        {
            inputEnabled = false;
            HideShip();

            Vector3 messagePoint = StartPosition() + new Vector3(-0.25f, 0.25f, 0.0f);

            MessageManager.ShowMessage("3", messagePoint);
            yield return(new WaitForSeconds(1.2f));

            MessageManager.ShowMessage("2", messagePoint);
            yield return(new WaitForSeconds(1.2f));

            MessageManager.ShowMessage("1", messagePoint);
            yield return(new WaitForSeconds(1.2f));
        }

        inputEnabled = true;
        ResetShip();

        var tween = new GoTweenConfig();

        tween.easeType = GoEaseType.BounceOut;
        tween.onComplete(SpawnComplete);
        Go.to(transform, 1.0f, tween.scale(1.0f));

        StartCoroutine(ApplyInvincibility());
    }
コード例 #2
0
ファイル: GoKitHelper.cs プロジェクト: waikayk/RitualCombat
	public static GoTween MakeTween(
		Transform TheTransform, 
		Vector3 Position, 
		Quaternion Rotation, 
		float MoveTime = 0.5f, 
		bool IsLocal = false, 
		GoEaseType Ease = GoEaseType.Linear,
		VoidDelegate OnCompleteFunction = null
		)
	{
		GoTweenConfig Config = new GoTweenConfig();
		Config.addTweenProperty(new PositionTweenProperty(Position, false, IsLocal));
		//Config.addTweenProperty(new EulerAnglesTweenProperty(Rotation, false, IsLocal));
		Config.addTweenProperty(new RotationQuaternionTweenProperty(Rotation, false, IsLocal));
		Config.setEaseType(Ease);
		if(OnCompleteFunction != null){
			Config.onComplete(c => {
				OnCompleteFunction();
			});
		}
		GoTween NewTween = new GoTween(TheTransform, MoveTime, Config);
		Go.addTween(NewTween);
		
		return NewTween;
	}
コード例 #3
0
 public void DestroyPlayerShip()
 {
     expls = Instantiate(Explosion,this.gameObject.transform.position, Quaternion.Euler(new Vector3(0,0,0))) as GameObject;
     this.gameObject.SetActive (false);
     GoTweenConfig config = new GoTweenConfig ();
     config.onComplete (delegate {
         Destroy (this.gameObject);
         GlobalManager.isPassed = false;
         GlobalManager.GotoStatisticPanel ();
         PlayerPrefs.SetInt("Score",GlobalManager.score);
         PlayerPrefs.SetInt("Level",GlobalManager.level);
     });
     Go.to (this.gameObject.transform, 2, config);
 }
コード例 #4
0
 static public int onComplete(IntPtr l)
 {
     try {
         GoTweenConfig self = (GoTweenConfig)checkSelf(l);
         System.Action <AbstractGoTween> a1;
         LuaDelegation.checkDelegate(l, 2, out a1);
         var ret = self.onComplete(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #5
0
    public void DestroyPlayerShip()
    {
        expls = Instantiate(Explosion, this.gameObject.transform.position, Quaternion.Euler(new Vector3(0, 0, 0))) as GameObject;
        this.gameObject.SetActive(false);
        GoTweenConfig config = new GoTweenConfig();

        config.onComplete(delegate {
            Destroy(this.gameObject);
            GlobalManager.isPassed = false;
            GlobalManager.GotoStatisticPanel();
            PlayerPrefs.SetInt("Score", GlobalManager.score);
            PlayerPrefs.SetInt("Level", GlobalManager.level);
        });
        Go.to(this.gameObject.transform, 2, config);
    }
コード例 #6
0
    void playSounds(List <KeyValuePair <string, int> > sortedSounds, List <AudioClip> clips)
    {
        AudioSource[] src = this.gameObject.GetComponents <AudioSource> ();

        audioGtc = new GoTweenChain();
        audioGtc.autoRemoveOnComplete = true;
        float accTime = 0;

        _curClipIndex = 0;
        for (int i = 0; i < sortedSounds.Count; ++i)
        {
            var   sd    = sortedSounds [i];
            float delay = sd.Value / 24.0f - accTime;
            if (delay > 0)
            {
                audioGtc.appendDelay(delay);
            }
            var cbcon = new GoTweenConfig();
            audioGtc.append(new GoTween(
                                gameObject.transform,
                                0.01f,
                                cbcon.onComplete(delegate(AbstractGoTween obj) {
                int ri                = _curClipIndex % maxChannels;
                src [ri].clip         = clips [_curClipIndex];
                src [ri].loop         = false;
                src [ri].spatialBlend = 0;
                src [ri].Play();
                ++_curClipIndex;
            })
                                ));
            accTime += delay;
        }

        // for some reason the last play callback
        // is not invoked, so I add one more tween
        // to ensure the last sound is played.
        audioGtc.appendDelay(0.5f);
        GoTweenConfig gtcfg = new GoTweenConfig();

        audioGtc.append(new GoTween(
                            gameObject.transform,
                            0.01f,
                            gtcfg.onComplete(delegate(AbstractGoTween obj) {
        })
                            ));

        audioGtc.play();
    }
コード例 #7
0
 // Use this for initialization
 void Start()
 {
     ProgressBar.transform.localPosition = new Vector3 (-500,0,0);
     GoTweenConfig config = new GoTweenConfig ();
     config.localPosition(new Vector3 (0, 0, 0));
     config.delay = 1f;
     config.setIterations (1);
     config.onUpdate (delegate(AbstractGoTween obj)
     {
         onProgress();
     });
     config.onComplete (delegate {
         GlobalManager.GotoGamePanel();
     });
     Go.to (ProgressBar.transform, 4, config);
 }
コード例 #8
0
ファイル: GUIMove.cs プロジェクト: polusto/Love-Birds
    public void MoveWindow(int easeType)
    {
        switch (easeType)
        {
            case 0:
                Go.defaultEaseType = GoEaseType.Linear;
                break;
            case 1:
                Go.defaultEaseType = GoEaseType.BackOut;
                break;
            case 2:
                Go.defaultEaseType = GoEaseType.BounceOut;
                break;
            case 3:
                Go.defaultEaseType = GoEaseType.CircInOut;
                break;
            case 4:
                Go.defaultEaseType = GoEaseType.SineOut;
                break;
            default:
                Go.defaultEaseType = GoEaseType.Linear;
                break;
        }

        float move = 0;

        if (goScreen)
        {
            move = -length;
        }
        else
        {
            move = length;
        }


        var moveUpConfig = new GoTweenConfig().position(new Vector3(move, 0), true);
        moveUpConfig.onComplete(orginalTween => Done());

        var tweenOne = new GoTween(this.transform, duration, moveUpConfig);

        var chain = new GoTweenChain();
        chain.append(tweenOne);

        chain.play();
    }
コード例 #9
0
ファイル: Player.cs プロジェクト: nialltl/Muddledash
    void Unbop()
    {
        if (canControl) return;

        StartCoroutine(InvincibilityTimeout());

        canControl = true;

        // Tween cleanup, remove stun halo
        Go.killAllTweensWithTarget(stunHalo);
        haloUndoConfig.clearEvents();
        haloUndoConfig.onComplete(c => {
            stunHalo.gameObject.SetActive(false);
        });
        Go.to(stunHalo, 0.5f, haloUndoConfig);

        if (tired) {
            face.SetFace(Face.FaceType.Tired);
        } else {
            // return to default face if we're not in 'surprised' mode
            if (face.ActiveFace != Face.FaceType.Surprised) {
                var reaction = Random.Range(0f, 1f) < 0.5f ?
                    Face.FaceType.Default :
                    Face.FaceType.Frowning;

                face.SetFace(reaction);
            }
        }

        isInked = false;
        head.DisableInkSplat();

        bopTweenConfig.clearEvents();
        bopTweenConfig.clearProperties();
        bopTweenConfig.setEaseType(GoEaseType.ElasticOut);

        if (elasticRoutine != null) StopCoroutine(elasticRoutine);
        elasticRoutine = StartCoroutine(ElasticStandUp());

        // Jump up from bopped position
        if (surface == Surface.Ground) {
            cachedVelocity = rbody.velocity;
            cachedVelocity.y = jumpSpeed / 1.5f;
            rbody.velocity = cachedVelocity;
        }
    }
コード例 #10
0
    // Use this for initialization
    void Start()
    {
        ProgressBar.transform.localPosition = new Vector3(-500, 0, 0);
        GoTweenConfig config = new GoTweenConfig();

        config.localPosition(new Vector3(0, 0, 0));
        config.delay = 1f;
        config.setIterations(1);
        config.onUpdate(delegate(AbstractGoTween obj)
        {
            onProgress();
        });
        config.onComplete(delegate {
            GlobalManager.GotoGamePanel();
        });
        Go.to(ProgressBar.transform, 4, config);
    }
コード例 #11
0
ファイル: PlayerMovement.cs プロジェクト: polusto/Love-Birds
    private void Move(Transform target, Vector3 to, Vector3 back, float duration)
    {
       
        animationReady = false;

        Go.defaultEaseType = GoEaseType.Linear;
        var moveUpConfig = new GoTweenConfig().position( to, true );
        var moveBackConfig = new GoTweenConfig().position( -back, true );
        moveBackConfig.onComplete(orginalTween => Done());

        var tweenOne = new GoTween( target, duration, moveUpConfig);
        var tweenTwo = new GoTween( target, duration, moveBackConfig);


        var chain = new GoTweenChain();
        chain.append(tweenOne).append(tweenTwo);

        chain.play();

    }
コード例 #12
0
ファイル: GUIMove.cs プロジェクト: polusto/Love-Birds
    public void ScaleWindow()
    {

        if (goScreen)
        {
            Go.defaultEaseType = GoEaseType.BounceOut;
            scale = Vector3.one;
        }
        else
        {
            Go.defaultEaseType = GoEaseType.BounceIn;
            scale = Vector3.zero;
        }
        var scaleConfig = new GoTweenConfig().scale(scale, false);
        scaleConfig.onComplete(orginalTween => ScaleDone());

        var tweenOne = new GoTween(this.transform, duration, scaleConfig);

        var chain = new GoTweenChain();
        chain.append(tweenOne);

        chain.play();
    }
コード例 #13
0
    void applyJumpSkillMove(List <Dictionary <string, string> > boxDataDict)
    {
        var rigidBody = gameObject.GetComponent <Rigidbody>();

        //rigidBody.velocity = testVelocity;

        gtc = new GoTweenChain();
        gtc.autoRemoveOnComplete = true;

        List <Dictionary <string, float> > atkOffsets = new List <Dictionary <string, float> >();

        int bi = 0;

        foreach (var boxData in boxDataDict)
        {
            if (boxData["self_aff"] != "跳跃")
            {
                break;
            }

            char[]   delimiterChars = { ',' };
            string[] sdata          = boxData["self_param"].Split(delimiterChars);

            if (sdata.Length < 3)
            {
                break;
            }

            List <float> fdata = new List <float>();
            foreach (string s in sdata)
            {
                fdata.Add(Convert.ToSingle(s));
            }
            float startTime = fdata[0];
            float angle     = fdata[1];
            float speed     = fdata[2];

            float vx = speed * Mathf.Cos(Mathf.Deg2Rad * angle);
            float vy = speed * Mathf.Sin(Mathf.Deg2Rad * angle);

            Dictionary <string, float> offsetData = new Dictionary <string, float>();
            offsetData["startTime"] = startTime;
            offsetData["velocityX"] = vx;
            offsetData["velocityY"] = vy;
            atkOffsets.Add(offsetData);

            var curData = atkOffsets[bi];
            if (bi >= 1)
            {
                var preData = atkOffsets[bi - 1];
                curData["delay"] = startTime - preData["startTime"];
            }
            else
            {
                if (startTime > 0)
                {
                    curData["delay"] = startTime;
                }
            }
            ++bi;
        }

        foreach (var v in atkOffsets)
        {
            if (v.ContainsKey("delay"))
            {
                var gtconfig = new GoTweenConfig();
                gtc.append(new GoTween(
                               gameObject.transform,
                               v["delay"],
                               gtconfig.onComplete(delegate(AbstractGoTween obj)
                {
                    rigidBody.velocity = new Vector3(v["velocityX"], v["velocityY"], 0.0f);
                })
                               ));
            }
        }

        var cbcon = new GoTweenConfig();

        gtc.append(new GoTween(
                       gameObject.transform,
                       0.01f,
                       cbcon.onComplete(delegate(AbstractGoTween obj)
        {
            //DestroyEfx ();
        })
                       ));

        gtc.appendDelay(2.0f);
        var con = new GoTweenConfig();

        gtc.append(new GoTween(
                       gameObject.transform,
                       0.01f,
                       con.position(Vector3.zero, false).setEaseType(GoEaseType.Linear).setUpdateType(GoUpdateType.FixedUpdate)
                       ));
        gtc.play();
    }
コード例 #14
0
ファイル: Crosshair.cs プロジェクト: RigaDevDay/rdd-cardboard
 private void resetConfig(float scale)
 {
     config = new GoTweenConfig ();
     config.onComplete (originalTween => animate = false);
     config.scale (scale);
 }
コード例 #15
0
    void applyNonJumpSkillMove(List <Dictionary <string, string> > boxDataDict)
    {
        gtc = new GoTweenChain();
        gtc.autoRemoveOnComplete = true;

        List <Dictionary <string, float> > atkOffsets = new List <Dictionary <string, float> >();

        int bi = 0;

        foreach (var boxData in boxDataDict)
        {
            if (boxData["self_aff"] != "位移")
            {
                break;
            }

            char[]   delimiterChars = { ',' };
            string[] sdata          = boxData["self_param"].Split(delimiterChars);

            if (sdata.Length < 3)
            {
                break;
            }

            List <float> fdata = new List <float>();
            foreach (string s in sdata)
            {
                fdata.Add(Convert.ToSingle(s));
            }
            float startTime = fdata[0] / 24;
            float speed     = fdata[1];
            float dist      = fdata[2];
            float duration  = Mathf.Abs(dist / speed);

            speed = dist / duration;

            Dictionary <string, float> offsetData = new Dictionary <string, float>();
            offsetData["startTime"] = startTime;
            offsetData["endTime"]   = startTime + duration;
            offsetData["curTime"]   = 0;
            offsetData["totalTime"] = duration;
            offsetData["speed"]     = speed;
            atkOffsets.Add(offsetData);

            if (bi >= 1)
            {
                var preData = atkOffsets[bi - 1];
                if (preData["endTime"] > startTime)
                {
                    preData["endTime"]   = startTime;
                    preData["totalTime"] = startTime - preData["startTime"];
                }
                else
                {
                    preData["delay"] = startTime - preData["endTime"];
                }
            }
            else
            {
                var curData = atkOffsets[bi];
                if (startTime > 0)
                {
                    curData["delay"] = startTime;
                }
            }

            ++bi;
        }

        foreach (var v in atkOffsets)
        {
            if (v.ContainsKey("delay"))
            {
                gtc.appendDelay(v["delay"]);
            }

            var gtconfig = new GoTweenConfig();
            if (v["totalTime"] > 0)
            {
                var dirInc = new Vector3(v["speed"] * v["totalTime"], 0, 0);
                gtc.append(new GoTween(
                               gameObject.transform,
                               v["totalTime"],
                               gtconfig.position(dirInc, true).setEaseType(GoEaseType.Linear).setUpdateType(GoUpdateType.FixedUpdate)
                               ));
            }
        }



        var cbcon = new GoTweenConfig();

        gtc.append(new GoTween(
                       gameObject.transform,
                       0.01f,
                       cbcon.onComplete(delegate(AbstractGoTween obj)
        {
            //DestroyEfx ();
        })
                       ));

        gtc.appendDelay(2.0f);
        var con = new GoTweenConfig();

        gtc.append(new GoTween(
                       gameObject.transform,
                       0.01f,
                       con.position(Vector3.zero, false).setEaseType(GoEaseType.Linear).setUpdateType(GoUpdateType.FixedUpdate)
                       ));
        gtc.play();
    }
コード例 #16
0
ファイル: GoKitHelper.cs プロジェクト: waikayk/RitualCombat
	public static GoTween MakeTweenScale(
		Transform TheTransform,
		Vector3 Scale,
		float MoveTime,
		bool IsLocal = false,
		GoEaseType Ease = GoEaseType.Linear,
		VoidDelegate OnCompleteFunction = null
		)
	{
		GoTweenConfig Config = new GoTweenConfig();
		Config.addTweenProperty(new ScaleTweenProperty(Scale, false));
		Config.setEaseType(Ease);
		if(OnCompleteFunction != null){
			Config.onComplete(c => {
				OnCompleteFunction();
			});
		}
		
		GoTween NewTween = new GoTween(TheTransform, MoveTime, Config);
		Go.addTween(NewTween);
		
		return NewTween;
	}
コード例 #17
0
    void SetupTweens()
    {
        // Ease
        DG.Tweening.Ease           dotweenEase = easing == Easing.Linear ? DG.Tweening.Ease.Linear : DG.Tweening.Ease.InOutQuad;
        Holoville.HOTween.EaseType hotweenEase = easing == Easing.Linear ? Holoville.HOTween.EaseType.Linear : Holoville.HOTween.EaseType.EaseInOutQuad;
        LeanTweenType leanEase = easing == Easing.Linear ? LeanTweenType.linear : LeanTweenType.easeInOutQuad;
        GoEaseType    goEase   = easing == Easing.Linear ? GoEaseType.Linear : GoEaseType.QuadInOut;

        iTween.EaseType iTweenEase = easing == Easing.Linear ? iTween.EaseType.linear : iTween.EaseType.easeInOutQuad;
        // Loop
        int loops = testSetup == TestSetup.Emit ? 1 : -1;

        DG.Tweening.LoopType       dotweenLoopType = testSetup == TestSetup.YoyoLoop ? DG.Tweening.LoopType.Yoyo : DG.Tweening.LoopType.Restart;
        Holoville.HOTween.LoopType hotweenLoopType = testSetup == TestSetup.YoyoLoop ? Holoville.HOTween.LoopType.Yoyo : Holoville.HOTween.LoopType.Restart;
        LeanTweenType leanLoopType = testSetup == TestSetup.YoyoLoop ? LeanTweenType.pingPong : LeanTweenType.clamp;
        GoLoopType    goLoopType   = testSetup == TestSetup.YoyoLoop ? GoLoopType.PingPong : GoLoopType.RestartFromBeginning;

        iTween.LoopType iTweenLoopType = loops != -1 ? iTween.LoopType.none : testSetup == TestSetup.YoyoLoop ? iTween.LoopType.pingPong : iTween.LoopType.loop;
        // Create tweens
        switch (testType)
        {
        case TestType.Floats:
            for (int i = 0; i < numTweens; ++i)
            {
                TestObjectData data = testObjsData[i];
                switch (engine)
                {
                case Engine.HOTween:
                    HOTween.To(data, duration, new Holoville.HOTween.TweenParms()
                               .Prop("floatValue", rndFloats[i])
                               .Ease(hotweenEase)
                               .Loops(loops, hotweenLoopType)
                               );
                    break;

                case Engine.LeanTween:
                    LeanTween.value(this.gameObject, x => data.floatValue = x, data.floatValue, rndFloats[i], duration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType);
                    break;

                case Engine.GoKit:
                    Go.to(data, duration, new GoTweenConfig()
                          .floatProp("floatValueProperty", rndFloats[i])
                          .setEaseType(goEase)
                          .setIterations(loops, goLoopType)
                          );
                    break;

                case Engine.iTween:
                    Hashtable hs = new Hashtable();
                    hs.Add("from", data.floatValue);
                    hs.Add("to", rndFloats[i]);
                    hs.Add("time", duration);
                    hs.Add("onupdate", "UpdateiTweenFloat");
                    hs.Add("looptype", iTweenLoopType);
                    hs.Add("easetype", iTweenEase);
                    iTween.ValueTo(this.gameObject, hs);
                    break;

                default:
                    // tCopy is needed to create correct closure object,
                    // otherwise closure will pass the same t to all the loop
                    TestObjectData dataCopy = data;
                    DOTween.To(() => dataCopy.floatValue, x => dataCopy.floatValue = x, rndFloats[i], duration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType);
                    break;
                }
            }
            break;

        default:
            for (int i = 0; i < numTweens; ++i)
            {
                float      twDuration = testSetup == TestSetup.Emit ? UnityEngine.Random.Range(0.25f, 1f) : duration;
                Transform  t          = testObjsTrans[i];
                GameObject go         = testObjsGos[i];         // Used by LeanTween and iTween
                switch (engine)
                {
                case Engine.HOTween:
                    Holoville.HOTween.TweenParms tp = new Holoville.HOTween.TweenParms()
                                                      .Ease(hotweenEase)
                                                      .Loops(loops, hotweenLoopType);
                    if (positionTween)
                    {
                        Vector3 toPos = rndPositions[i];
                        tp.Prop("position", toPos);
                        if (testSetup == TestSetup.Emit)
                        {
                            tp.OnComplete(() => EmitHOTweenPositionFor(t, toPos, twDuration, hotweenEase));
                        }
                    }
                    if (rotationTween)
                    {
                        Vector3 toRot = rndRotations[i];
                        tp.Prop("rotation", toRot);
                        if (testSetup == TestSetup.Emit)
                        {
                            tp.OnComplete(() => EmitHOTweenRotationFor(t, toRot, twDuration, hotweenEase));
                        }
                    }
                    if (scaleTween)
                    {
                        tp.Prop("localScale", rndScale);
                        if (testSetup == TestSetup.Emit)
                        {
                            tp.OnComplete(() => EmitHOTweenScaleFor(t, rndScale, twDuration, hotweenEase));
                        }
                    }
                    HOTween.To(t, twDuration, tp);
                    break;

                case Engine.LeanTween:
                    LTDescr leanTween;
                    if (positionTween)
                    {
                        Vector3 toPos = rndPositions[i];
                        leanTween = LeanTween.move(go, rndPositions[i], twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            leanTween.setOnComplete(() => EmitLeanTweenPositionFor(t, go, toPos, twDuration, leanEase));
                        }
                    }
                    if (rotationTween)
                    {
                        Vector3 toRot = rndRotations[i];
                        leanTween = LeanTween.rotate(go, rndRotations[i], twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            leanTween.setOnComplete(() => EmitLeanTweenRotationFor(t, go, toRot, twDuration, leanEase));
                        }
                    }
                    if (scaleTween)
                    {
                        leanTween = LeanTween.scale(go, rndScale, twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            leanTween.setOnComplete(() => EmitLeanTweenScaleFor(t, go, rndScale, twDuration, leanEase));
                        }
                    }
                    break;

                case Engine.GoKit:
                    GoTweenConfig goConfig = new GoTweenConfig()
                                             .setEaseType(goEase)
                                             .setIterations(loops, goLoopType);
                    if (positionTween)
                    {
                        Vector3 toPos = rndPositions[i];
                        goConfig.addTweenProperty(new PositionTweenProperty(toPos));
                        if (testSetup == TestSetup.Emit)
                        {
                            goConfig.onComplete(x => EmitGoKitPositionFor(t, toPos, twDuration, goEase));
                        }
                    }
                    if (rotationTween)
                    {
                        Vector3 toRot = rndRotations[i];
                        goConfig.addTweenProperty(new RotationTweenProperty(toRot));
                        if (testSetup == TestSetup.Emit)
                        {
                            goConfig.onComplete(x => EmitGoKitRotationFor(t, toRot, twDuration, goEase));
                        }
                    }
                    if (scaleTween)
                    {
                        goConfig.addTweenProperty(new ScaleTweenProperty(rndScale));
                        if (testSetup == TestSetup.Emit)
                        {
                            goConfig.onComplete(x => EmitGoKitScaleFor(t, rndScale, twDuration, goEase));
                        }
                    }
                    Go.to(t, twDuration, goConfig);
                    break;

                case Engine.iTween:
                    Hashtable hs;
                    if (positionTween)
                    {
                        hs = new Hashtable();
                        hs.Add("position", rndPositions[i]);
                        hs.Add("time", twDuration);
                        hs.Add("looptype", iTweenLoopType);
                        hs.Add("easetype", iTweenEase);
                        iTween.MoveTo(go, hs);
                    }
                    if (rotationTween)
                    {
                        hs = new Hashtable();
                        hs.Add("rotation", rndRotations[i]);
                        hs.Add("time", twDuration);
                        hs.Add("looptype", iTweenLoopType);
                        hs.Add("easetype", iTweenEase);
                        iTween.RotateTo(go, hs);
                    }
                    if (scaleTween)
                    {
                        hs = new Hashtable();
                        hs.Add("scale", rndScale);
                        hs.Add("time", twDuration);
                        hs.Add("looptype", iTweenLoopType);
                        hs.Add("easetype", iTweenEase);
                        iTween.ScaleTo(go, hs);
                    }
                    break;

                default:
                    // tCopy is needed to create correct closure object,
                    // otherwise closure will pass the same t to all the loop
                    Transform         tCopy = t;
                    DG.Tweening.Tween dotween;
                    if (positionTween)
                    {
                        Vector3 toPos = rndPositions[i];
                        dotween = tCopy.DOMove(toPos, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            dotween.OnComplete(() => EmitDOTweenPositionFor(t, toPos, twDuration, dotweenEase));
                        }
                    }
                    if (rotationTween)
                    {
                        Vector3 toRot = rndRotations[i];
                        dotween = tCopy.DORotate(toRot, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            dotween.OnComplete(() => EmitDOTweenRotationFor(t, toRot, twDuration, dotweenEase));
                        }
                    }
                    if (scaleTween)
                    {
                        dotween = tCopy.DOScale(rndScale, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            dotween.OnComplete(() => EmitDOTweenScaleFor(t, rndScale, twDuration, dotweenEase));
                        }
                    }
                    break;
                }
            }
            break;
        }
    }
コード例 #18
0
ファイル: FxUtils.cs プロジェクト: tanis2000/Futile
 public static void FadeTo(FNode node, float alpha,float duration,bool autoRemove)
 {
     GoTweenConfig config=new GoTweenConfig().floatProp("alpha",alpha);
     if (autoRemove) {
         config.onComplete(FxHelper.Instance.RemoveFromContainer);
     }
     Go.to(node,duration,config);
 }
コード例 #19
0
ファイル: FxUtils.cs プロジェクト: tanis2000/Futile
 public static void FadeColorTo(FNode node, Color color,float duration,bool autoRemove)
 {
     GoTweenConfig config=new GoTweenConfig().colorProp("color",color);
     if (autoRemove) {
         config.onComplete(FxHelper.Instance.RemoveFromContainer);
     }
     Go.to(node,duration,config);
 }
コード例 #20
0
	void SetupTweens()
	{
		// Ease
		DG.Tweening.Ease dotweenEase = easing == Easing.Linear ? DG.Tweening.Ease.Linear : DG.Tweening.Ease.InOutQuad;
		Holoville.HOTween.EaseType hotweenEase = easing == Easing.Linear ? Holoville.HOTween.EaseType.Linear : Holoville.HOTween.EaseType.EaseInOutQuad;
		LeanTweenType leanEase = easing == Easing.Linear ? LeanTweenType.linear : LeanTweenType.easeInOutQuad;
		GoEaseType goEase = easing == Easing.Linear ? GoEaseType.Linear : GoEaseType.QuadInOut;
		iTween.EaseType iTweenEase = easing == Easing.Linear ? iTween.EaseType.linear : iTween.EaseType.easeInOutQuad;
		// Loop
		int loops = testSetup == TestSetup.Emit ? 1 : -1;
		DG.Tweening.LoopType dotweenLoopType = testSetup == TestSetup.YoyoLoop ? DG.Tweening.LoopType.Yoyo : DG.Tweening.LoopType.Restart;
		Holoville.HOTween.LoopType hotweenLoopType = testSetup == TestSetup.YoyoLoop ? Holoville.HOTween.LoopType.Yoyo : Holoville.HOTween.LoopType.Restart;
		LeanTweenType leanLoopType = testSetup == TestSetup.YoyoLoop ? LeanTweenType.pingPong : LeanTweenType.clamp;
		GoLoopType goLoopType = testSetup == TestSetup.YoyoLoop ? GoLoopType.PingPong : GoLoopType.RestartFromBeginning;
		iTween.LoopType iTweenLoopType = loops != -1 ? iTween.LoopType.none : testSetup == TestSetup.YoyoLoop ? iTween.LoopType.pingPong : iTween.LoopType.loop;
		// Create tweens
		switch (testType) {
		case TestType.Floats:
			for (int i = 0; i < numTweens; ++i) {
				TestObjectData data = testObjsData[i];
				switch (engine) {
				case Engine.HOTween:
					HOTween.To(data, duration, new Holoville.HOTween.TweenParms()
						.Prop("floatValue", rndFloats[i])
						.Ease(hotweenEase)
						.Loops(loops, hotweenLoopType)
					);
					break;
				case Engine.LeanTween:
					LeanTween.value(this.gameObject, x=> data.floatValue = x, data.floatValue, rndFloats[i], duration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType);
					break;
				case Engine.GoKit:
					Go.to(data, duration, new GoTweenConfig()
						.floatProp("floatValueProperty", rndFloats[i])
						.setEaseType(goEase)
						.setIterations(loops, goLoopType)
					);
					break;
				case Engine.iTween:
					Hashtable hs = new Hashtable();
					hs.Add("from", data.floatValue);
					hs.Add("to", rndFloats[i]);
					hs.Add("time", duration);
					hs.Add("onupdate", "UpdateiTweenFloat");
					hs.Add("looptype", iTweenLoopType);
					hs.Add("easetype", iTweenEase);
					iTween.ValueTo(this.gameObject, hs);
					break;
				default:
					// tCopy is needed to create correct closure object,
					// otherwise closure will pass the same t to all the loop
					TestObjectData dataCopy = data;
					DOTween.To(()=> dataCopy.floatValue, x=> dataCopy.floatValue = x, rndFloats[i], duration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType);
					break;
				}
			}
			break;
		default:
			for (int i = 0; i < numTweens; ++i) {
				float twDuration = testSetup == TestSetup.Emit ? UnityEngine.Random.Range(0.25f, 1f) : duration;
				Transform t = testObjsTrans[i];
				GameObject go = testObjsGos[i]; // Used by LeanTween and iTween
				switch (engine) {
				case Engine.HOTween:
					Holoville.HOTween.TweenParms tp = new Holoville.HOTween.TweenParms()
						.Ease(hotweenEase)
						.Loops(loops, hotweenLoopType);
					if (positionTween) {
						Vector3 toPos = rndPositions[i];
						tp.Prop("position", toPos);
						if (testSetup == TestSetup.Emit) tp.OnComplete(()=> EmitHOTweenPositionFor(t, toPos, twDuration, hotweenEase));
					}
					if (rotationTween) {
						Vector3 toRot = rndRotations[i];
						tp.Prop("rotation", toRot);
						if (testSetup == TestSetup.Emit) tp.OnComplete(()=> EmitHOTweenRotationFor(t, toRot, twDuration, hotweenEase));
					}
					if (scaleTween) {
						tp.Prop("localScale", rndScale);
						if (testSetup == TestSetup.Emit) tp.OnComplete(()=> EmitHOTweenScaleFor(t, rndScale, twDuration, hotweenEase));
					}
					HOTween.To(t, twDuration, tp);
					break;
				case Engine.LeanTween:
					LTDescr leanTween;
					if (positionTween) {
						Vector3 toPos = rndPositions[i];
						leanTween = LeanTween.move(go, rndPositions[i], twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType);
						if (testSetup == TestSetup.Emit) leanTween.setOnComplete(()=> EmitLeanTweenPositionFor(t, go, toPos, twDuration, leanEase));
					}
					if (rotationTween) {
						Vector3 toRot = rndRotations[i];
						leanTween = LeanTween.rotate(go, rndRotations[i], twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType);
						if (testSetup == TestSetup.Emit) leanTween.setOnComplete(()=> EmitLeanTweenRotationFor(t, go, toRot, twDuration, leanEase));
					}
					if (scaleTween) {
						leanTween = LeanTween.scale(go, rndScale, twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType);
						if (testSetup == TestSetup.Emit) leanTween.setOnComplete(()=> EmitLeanTweenScaleFor(t, go, rndScale, twDuration, leanEase));
					}
					break;
				case Engine.GoKit:
					GoTweenConfig goConfig = new GoTweenConfig()
						.setEaseType(goEase)
						.setIterations(loops, goLoopType);
					if (positionTween) {
						Vector3 toPos = rndPositions[i];
						goConfig.addTweenProperty(new PositionTweenProperty(toPos));
						if (testSetup == TestSetup.Emit) goConfig.onComplete(x=> EmitGoKitPositionFor(t, toPos, twDuration, goEase));
					}
					if (rotationTween) {
						Vector3 toRot = rndRotations[i];
						goConfig.addTweenProperty(new RotationTweenProperty(toRot));
						if (testSetup == TestSetup.Emit) goConfig.onComplete(x=> EmitGoKitRotationFor(t, toRot, twDuration, goEase));
					}
					if (scaleTween) {
						goConfig.addTweenProperty(new ScaleTweenProperty(rndScale));
						if (testSetup == TestSetup.Emit) goConfig.onComplete(x=> EmitGoKitScaleFor(t, rndScale, twDuration, goEase));
					}
					Go.to(t, twDuration, goConfig);
					break;
				case Engine.iTween:
					Hashtable hs;
					if (positionTween) {
						hs = new Hashtable();
						hs.Add("position", rndPositions[i]);
						hs.Add("time", twDuration);
						hs.Add("looptype", iTweenLoopType);
						hs.Add("easetype", iTweenEase);
						iTween.MoveTo(go, hs);
					}
					if (rotationTween) {
						hs = new Hashtable();
						hs.Add("rotation", rndRotations[i]);
						hs.Add("time", twDuration);
						hs.Add("looptype", iTweenLoopType);
						hs.Add("easetype", iTweenEase);
						iTween.RotateTo(go, hs);
					}
					if (scaleTween) {
						hs = new Hashtable();
						hs.Add("scale", rndScale);
						hs.Add("time", twDuration);
						hs.Add("looptype", iTweenLoopType);
						hs.Add("easetype", iTweenEase);
						iTween.ScaleTo(go, hs);
					}
					break;
				default:
					// tCopy is needed to create correct closure object,
					// otherwise closure will pass the same t to all the loop
					Transform tCopy = t;
					DG.Tweening.Tween dotween;
					if (positionTween) {
						Vector3 toPos = rndPositions[i];
						dotween = tCopy.DOMove(toPos, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType);
						if (testSetup == TestSetup.Emit) dotween.OnComplete(()=> EmitDOTweenPositionFor(t, toPos, twDuration, dotweenEase));
					}
					if (rotationTween) {
						Vector3 toRot = rndRotations[i];
						dotween = tCopy.DORotate(toRot, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType);
						if (testSetup == TestSetup.Emit) dotween.OnComplete(()=> EmitDOTweenRotationFor(t, toRot, twDuration, dotweenEase));
					}
					if (scaleTween) {
						dotween = tCopy.DOScale(rndScale, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType);
						if (testSetup == TestSetup.Emit) dotween.OnComplete(()=> EmitDOTweenScaleFor(t, rndScale, twDuration, dotweenEase));
					}
					break;
				}
			}
			break;
		}
	}
コード例 #21
0
 public static GoTweenConfig removeWhenComplete(this GoTweenConfig config)
 {
     config.onComplete(HandleRemoveWhenDoneTweenComplete);
     return(config);
 }