예제 #1
0
    //Detect when delay was passed
    private void DetectDelay()
    {
        foreach (BaseTweenObject tween in tweens)
        {
            if (Time.time > tween.startTime + tween.delay && !tween.canStart)
            {
                if (tween.tweenType == TweenType.TweenPosition)
                {
                    TweenPositionObject tweenPos = tween as TweenPositionObject;
                    tweenPos.startValue = this.transform.position;
                }
                else if (tween.tweenType == TweenType.TweenRotation)
                {
                    TweenRotationObject tweenRot = tween as TweenRotationObject;
                    tweenRot.startValue = this.transform.rotation.eulerAngles;
                }
                else if (tween.tweenType == TweenType.TweenAlpha)
                {
                    TweenAlphaObject tweenAlpha = tween as TweenAlphaObject;
                    if (GetComponent <GUITexture> () != null)
                    {
                        tweenAlpha.startValue = GetComponent <GUITexture> ().color.a;
                    }
                    else
                    {
                        tweenAlpha.startValue = this.GetComponent <Renderer> ().material.color.a;
                    }
                }

                this.ClearTweensSameType(tween);

                tween.canStart = true;
            }
        }
    }
예제 #2
0
    //Tween rotation
    public void TweenRotation(TweenRotationObject obj)
    {
        TweenRotationObject tween = new TweenRotationObject();

        tween.startTime = Time.time;
        tween.CopyTween(obj);
        tween.tweenValue = obj.tweenValue;
        tween.Init();

        this.tweens.Add(tween);
    }
예제 #3
0
    //Update Rotation
    private void UpdateRotation(TweenRotationObject tween)
    {
        Vector3 begin       = tween.startValue;
        Vector3 finish      = tween.tweenValue;
        Vector3 change      = finish - begin;
        float   duration    = tween.totalTime;
        float   currentTime = Time.time - (tween.startTime + tween.delay);

        if (duration == 0)
        {
            this.EndTween(tween);
            this.transform.position = finish;
            return;
        }


        if (Time.time > tween.startTime + tween.delay + duration)
        {
            this.EndTween(tween);
        }

        this.transform.rotation = Quaternion.Euler(Equations.ChangeVector(currentTime, begin, change, duration, tween.ease));
    }