示例#1
0
    /// <summary>
    /// This will tween the "point" value on a Rotation Tween. Use this if you have a Rotation tween on a GameObject that is moving.
    /// </summary>
    public Tween TweenRotationPoint(TweenStyle tweenStyle, Vector3 fromPoint, Vector3 toPoint, float duration, LoopType loopType = LoopType.None)
    {
        // If the TweenType for the current Tween is not a Rotation then do nothing
        if (tweenType != TweenType.Rotation)
        {
            Debug.LogWarning("Cannot set a TweenType.RotationPoint on a Tween that is not a TweenType.Rotation.");
            return(null);
        }

        Tween tween = GetTween(this.gameObject, TweenType.RotationPoint);

        if (tween == null)
        {
            tween = this.gameObject.AddComponent <Tween>();
        }

        tween.tweenType  = TweenType.RotationPoint;
        tween.tweenStyle = tweenStyle;
        tween.fromPoint  = fromPoint;
        tween.toPoint    = toPoint;
        tween.duration   = duration;
        tween.loopType   = loopType;

        return(tween);
    }
 public void SetTweenInfo(TweenInfo info)
 {
     m_Duration          = info.duration;
     m_Style             = info.style;
     m_UpdateType        = info.updateType;
     m_UnscaledDeltaTime = info.unscaledDeltaTime;
 }
示例#3
0
    private static Tween CreateColourTween(GameObject obj, TweenType tweenType, TweenStyle tweenStyle, Color fromValue, Color toValue, float duration, LoopType loopType)
    {
        Tween tween = GetTween(obj, tweenType);

        if (tween == null)
        {
            tween = obj.AddComponent <Tween>();
        }

        tween.tweenType  = tweenType;
        tween.tweenStyle = tweenStyle;
        tween.fromColour = fromValue;
        tween.toColour   = toValue;
        tween.duration   = duration;
        tween.loopType   = loopType;

        return(tween);
    }
示例#4
0
    public void SetUpTween(TweenStyle scaleTween)
    {
        if (_element is null)
        {
            return;
        }

        if (scaleTween != TweenStyle.NoTween)
        {
            DoScaleTween = true;
        }
        else
        {
            DoScaleTween = false;
            var localScale = _element.localScale;
            _startScale = localScale;
            _fullSize   = localScale;
            _endScale   = localScale;
        }

        if (scaleTween == TweenStyle.InAndOut)
        {
            _startScale = Vector3.zero;
            _fullSize   = _element.localScale;
            _endScale   = Vector3.zero;
            MidTween    = true;
        }
        else
        {
            if (scaleTween == TweenStyle.In)
            {
                _startScale = Vector3.zero;
                _fullSize   = Vector3.zero;
                _endScale   = _element.localScale;
            }
            else
            {
                _startScale = _element.localScale;
                _fullSize   = Vector3.zero;
                _endScale   = Vector3.zero;
            }
            MidTween = false;
        }
    }
示例#5
0
    private static Tween CreateTween(GameObject obj, TweenType tweenType, TweenStyle tweenStyle, float fromValue, float toValue, float duration, bool transformLocal, LoopType loopType)
    {
        Tween tween = GetTween(obj, tweenType);

        if (tween == null)
        {
            tween = obj.AddComponent <Tween>();
        }

        tween.tweenType  = tweenType;
        tween.tweenStyle = tweenStyle;
        tween.fromValue  = fromValue;
        tween.toValue    = toValue;
        tween.duration   = duration;
        tween.useLocal   = transformLocal;
        tween.loopType   = loopType;

        return(tween);
    }
示例#6
0
    private static Tween CreateRotationTween(GameObject obj, TweenType tweenType, TweenStyle tweenStyle, Transform point, Vector3 axis, float angle, float duration, LoopType loopType)
    {
        Tween tween = GetTween(obj, tweenType);

        if (tween == null)
        {
            tween = obj.AddComponent <Tween>();
        }

        tween.angleSoFar = 0;

        tween.tweenType  = tweenType;
        tween.tweenStyle = tweenStyle;
        tween.pointT     = point;
        tween.axis       = axis;
        tween.fromValue  = 0;
        tween.toValue    = angle;
        tween.duration   = duration;
        tween.loopType   = loopType;

        return(tween);
    }
示例#7
0
    public void SetUpTween(TweenStyle rotationTween)
    {
        if (_element is null)
        {
            return;
        }

        if (rotationTween != TweenStyle.NoTween)
        {
            RotationTween = true;
        }
        else
        {
            RotationTween   = false;
            _rotateFrom     = Vector3.zero;
            _rotateMidPoint = Vector3.zero;
            _rotateToo      = Vector3.zero;
        }

        if (rotationTween == TweenStyle.InAndOut)
        {
            _rotateMidPoint = _element.localRotation.eulerAngles;
            MidRotation     = true;
        }
        else
        {
            if (rotationTween == TweenStyle.In)
            {
                _rotateToo = _element.localRotation.eulerAngles;
            }
            else
            {
                _rotateFrom = _element.localRotation.eulerAngles;
            }
            MidRotation = false;
        }
    }
示例#8
0
 /// <summary>
 /// Tweens the color of the Material
 /// </summary>
 public static Tween Colour(Renderer renderer, TweenStyle tweenStyle, Color fromValue, Color toValue, float duration, LoopType loopType = LoopType.None)
 {
     return(CreateColourTween(renderer.gameObject, TweenType.ColourMaterial, tweenStyle, fromValue, toValue, duration, loopType));
 }
示例#9
0
 /// <summary>
 /// Tweens the color of the UI Text
 /// </summary>
 public static Tween Colour(UnityEngine.UI.Text uiText, TweenStyle tweenStyle, Color fromValue, Color toValue, float duration, LoopType loopType = LoopType.None)
 {
     return(CreateColourTween(uiText.gameObject, TweenType.ColourText, tweenStyle, fromValue, toValue, duration, loopType));
 }
示例#10
0
 /// <summary>
 /// Rotates the GameObject around a point on the axis by the given angle
 /// </summary>
 public static Tween RotateAround(Transform transform, TweenStyle tweenStyle, Transform point, Vector3 axis, float angle, float duration, LoopType loopType = LoopType.None)
 {
     return(CreateRotationTween(transform.gameObject, TweenType.Rotation, tweenStyle, point, axis, angle, duration, loopType));
 }
示例#11
0
 /// <summary>
 /// Tweens the Z scale of the GameObject
 /// </summary>
 public static Tween ScaleZ(Transform transform, TweenStyle tweenStyle, float fromValue, float toValue, float duration, LoopType loopType = LoopType.None)
 {
     return(CreateTween(transform.gameObject, TweenType.ScaleZ, tweenStyle, fromValue, toValue, duration, true, loopType));
 }
示例#12
0
 /// <summary>
 /// Tweens the alpha on a canvas group
 /// </summary>
 public static Tween CanvasGroupAlpha(CanvasGroup canvasGroup, TweenStyle tweenStyle, float fromValue, float toValue, float duration)
 {
     return(CreateTween(canvasGroup.gameObject, TweenType.CanvaGroup, tweenStyle, fromValue, toValue, duration, false, LoopType.None));
 }
示例#13
0
 public void SetUpTween(TweenStyle tween)
 {
     PositionTween = tween != TweenStyle.NoTween;
     MiddleTween   = tween == TweenStyle.InAndOut;
     ClearPositionTween();
 }
示例#14
0
 public virtual void SetAlpha(float startalpha, float alpha, float animTime, TweenStyle style)
 {
 }
示例#15
0
 public void ClearSettings(TweenStyle clear)
 {
     _positionSettings.SetUpTween(clear);
     _rotationSettings.SetUpTween(clear);
     _scaleSettings.SetUpTween(clear);
 }
示例#16
0
 /// <summary>
 /// Tweens the Z position of the GameObject
 /// </summary>
 public static Tween PositionZ(Transform transform, TweenStyle tweenStyle, float fromValue, float toValue, float duration, bool transformLocal = false, LoopType loopType = LoopType.None)
 {
     return(CreateTween(transform.gameObject, TweenType.PositionZ, tweenStyle, fromValue, toValue, duration, transformLocal, loopType));
 }
示例#17
0
 /// <summary>
 /// Tweens the height of the RectTransform
 /// </summary>
 public static Tween RectTransformHeight(RectTransform transform, TweenStyle tweenStyle, float fromValue, float toValue, float duration)
 {
     return(CreateTween(transform.gameObject, TweenType.RectTransformHeight, tweenStyle, fromValue, toValue, duration, false, LoopType.None));
 }