当前位置: 首页>>代码示例>>C#>>正文


C# Tween.SetTarget方法代码示例

本文整理汇总了C#中Tween.SetTarget方法的典型用法代码示例。如果您正苦于以下问题:C# Tween.SetTarget方法的具体用法?C# Tween.SetTarget怎么用?C# Tween.SetTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tween的用法示例。


在下文中一共展示了Tween.SetTarget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Awake


//.........这里部分代码省略.........
                c = this.GetComponent<TextMeshProUGUI>();
                if (c != null) {
                   _tween = ((TextMeshProUGUI)c).DOFade(endValueFloat, duration);
                    goto SetupTween;
                }
#endif
                c = this.GetComponent<SpriteRenderer>();
                if (c != null) {
                    _tween = ((SpriteRenderer)c).DOFade(endValueFloat, duration);
                    goto SetupTween;
                }
                c = this.GetComponent<Renderer>();
                if (c != null) {
                    _tween = ((Renderer)c).material.DOFade(endValueFloat, duration);
                    goto SetupTween;
                }
                c = this.GetComponent<Image>();
                if (c != null) {
                    _tween = ((Image)c).DOFade(endValueFloat, duration);
                    goto SetupTween;
                }
                c = this.GetComponent<Text>();
                if (c != null) {
                    _tween = ((Text)c).DOFade(endValueFloat, duration);
                    goto SetupTween;
                }
                break;
            case DOTweenAnimationType.Text:
                c = this.GetComponent<Text>();
                if (c != null) {
                    _tween = ((Text)c).DOText(endValueString, duration, optionalBool0, optionalScrambleMode, optionalString);
                    goto SetupTween;
                }
#if TK2D
                c = this.GetComponent<tk2dTextMesh>();
                if (c != null) {
                   _tween = ((tk2dTextMesh)c).DOText(endValueString, duration, optionalBool0, optionalScrambleMode, optionalString);
                    goto SetupTween;
                }
#endif
#if TEXTMESHPRO
                c = this.GetComponent<TextMeshPro>();
                if (c != null) {
                   _tween = ((TextMeshPro)c).DOText(endValueString, duration, optionalBool0, optionalScrambleMode, optionalString);
                    goto SetupTween;
                }
                c = this.GetComponent<TextMeshProUGUI>();
                if (c != null) {
                   _tween = ((TextMeshProUGUI)c).DOText(endValueString, duration, optionalBool0, optionalScrambleMode, optionalString);
                    goto SetupTween;
                }
#endif
                break;
            case DOTweenAnimationType.PunchPosition:
                _tween = transform.DOPunchPosition(endValueV3, duration, optionalInt0, optionalFloat0, optionalBool0);
                break;
            case DOTweenAnimationType.PunchScale:
                _tween = transform.DOPunchScale(endValueV3, duration, optionalInt0, optionalFloat0);
                break;
            case DOTweenAnimationType.PunchRotation:
                _tween = transform.DOPunchRotation(endValueV3, duration, optionalInt0, optionalFloat0);
                break;
            case DOTweenAnimationType.ShakePosition:
                _tween = transform.DOShakePosition(duration, endValueV3, optionalInt0, optionalFloat0, optionalBool0);
                break;
            case DOTweenAnimationType.ShakeScale:
                _tween = transform.DOShakeScale(duration, endValueV3, optionalInt0, optionalFloat0);
                break;
            case DOTweenAnimationType.ShakeRotation:
                _tween = transform.DOShakeRotation(duration, endValueV3, optionalInt0, optionalFloat0);
                break;
            }

        SetupTween:
            if (_tween == null) return;

            if (isFrom) {
                ((Tweener)_tween).From(isRelative);
            } else {
                _tween.SetRelative(isRelative);
            }
            _tween.SetTarget(this.gameObject).SetDelay(delay).SetLoops(loops, loopType).SetAutoKill(autoKill)
                .OnKill(()=> _tween = null);
            if (easeType == Ease.INTERNAL_Custom) _tween.SetEase(easeCurve);
            else _tween.SetEase(easeType);
            if (!string.IsNullOrEmpty(id)) _tween.SetId(id);

            if (hasOnStart) {
                if (onStart != null) _tween.OnStart(onStart.Invoke);
            } else onStart = null;
            if (hasOnStepComplete) {
                if (onStepComplete != null) _tween.OnStepComplete(onStepComplete.Invoke);
            } else onStepComplete = null;
            if (hasOnComplete) {
                if (onComplete != null) _tween.OnComplete(onComplete.Invoke);
            } else onComplete = null;

            if (autoPlay) _tween.Play();
            else _tween.Pause();
        }
开发者ID:alexander91,项目名称:ludum33PureMonster,代码行数:101,代码来源:DOTweenAnimation.cs


注:本文中的Tween.SetTarget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。