本文整理汇总了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();
}