本文整理汇总了C#中LeanTweenType类的典型用法代码示例。如果您正苦于以下问题:C# LeanTweenType类的具体用法?C# LeanTweenType怎么用?C# LeanTweenType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LeanTweenType类属于命名空间,在下文中一共展示了LeanTweenType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PlayWithFadeInAt
public void PlayWithFadeInAt(InMusicGroup musicGroup, float targetVolume, float duration, double dspTime, LeanTweenType tweenType = LeanTweenType.easeInOutQuad)
{
var parent = GetParent(musicGroup);
PlayAt(parent, dspTime);
SetVolume(parent, 0);
Fade(parent, targetVolume, duration, tweenType, Time.time + Mathf.Max((float)(dspTime - AudioSettings.dspTime), 0));
}
示例2: PlayWithFadeIn
public void PlayWithFadeIn(InMusicGroup musicGroup, float targetVolume, float duration, LeanTweenType tweenType = LeanTweenType.easeInOutQuad)
{
var parent = GetParent(musicGroup);
Play(parent);
SetVolume(parent, 0);
Fade(parent, targetVolume, duration, tweenType, Time.time);
}
示例3: StopAll
public void StopAll(InAudioNode node, float fadeOutTime, LeanTweenType type)
{
if (node.IsRootOrFolder)
{
Debug.LogWarning("InAudio: Cannot stop audio on \"" + node.GetName + "\" as it is a folder");
}
foreach (var audioNode in GOAudioNodes)
{
var infoList = audioNode.Value;
if (infoList != null)
{
int count = infoList.InfoList.Count;
for (int i = 0; i < count; i++)
{
if (infoList.InfoList[i].Node == node)
{
infoList.InfoList[i].Player.Stop();
}
}
}
}
}
示例4: PlayConnectedTo
public InPlayer PlayConnectedTo(GameObject controllingObject, InAudioNode audioNode, GameObject attachedTo, AudioParameters audioParameters, float fade = 0f, LeanTweenType fadeType = LeanTweenType.notUsed)
{
if (audioNode.IsRootOrFolder)
{
Debug.LogWarning("InAudio: Cannot play \""+audioNode.GetName+"\" as it is a folder");
return null;
}
List<InstanceInfo> currentInstances = audioNode.CurrentInstances;
if (!AllowedStealing(audioNode, currentInstances))
{
return null;
}
var runtimePlayer = InAudioInstanceFinder.RuntimePlayerControllerPool.GetObject();
if (runtimePlayer == null)
{
Debug.LogWarning("InAudio: A pooled objected was not initialized. Try to restart play mode. If the problem persists, please submit a bug report.");
}
currentInstances.Add(new InstanceInfo(AudioSettings.dspTime, runtimePlayer));
runtimePlayer.transform.parent = attachedTo.transform;
runtimePlayer.transform.localPosition = new Vector3();
Play(controllingObject, audioNode, runtimePlayer, fade, fadeType, audioParameters);
return runtimePlayer;
}
示例5: Fade
public static void Fade(RectTransform trs,float alpha,float time,LeanTweenType type=LeanTweenType.linear,Action complete = null)
{
LTDescr d = LeanTween.alpha(trs, alpha, time).setEase(type);
if (complete != null)
{
d.setOnComplete(complete);
}
}
示例6: FadeIn
public void FadeIn(float dur, LeanTweenType trans = LeanTweenType.easeInCubic, Action callback = null)
{
if (m_ease != null && LeanTween.isTweening(m_ease.uniqueId))
LeanTween.cancel(m_ease.uniqueId);
m_ease = LeanTween.value(gameObject, OnFade, m_blackScreenAlpha, 0, dur).setEase(trans);
m_ease.onComplete = callback;
}
示例7: EnemyRotateTo
public EnemyRotateTo(RotateToData _data)
{
tweenDesc = null;
angle = _data.angle;
time = _data.time;
isAiming = _data.aim;
ease = (LeanTweenType)Enum.Parse(typeof(LeanTweenType), _data.ease);
direction = _data.direction;
}
示例8: MoveActionY
public static void MoveActionY(CanvasGroup cg, float to, float alpha, float time, float alphatime = -1, LeanTweenType type = LeanTweenType.linear, Action complete = null)
{
LTRect cgrect = new LTRect();
cgrect.alpha = cg.alpha;
alphatime = (alphatime < 0) ? to : alphatime;
LeanTween.alpha(cgrect, alpha, time).setEase(type);
LTDescr d = LeanTween.moveLocalY(cg.transform.gameObject, to, time).setEase(type);
d.setOnUpdate((float f) => { UpdateAlpha(cg, cgrect.alpha); });
if (complete != null)
{
d.setOnComplete(complete);
}
}
示例9: Alpha
public static void Alpha(CanvasGroup cg,float alpha,float time,LeanTweenType type=LeanTweenType.linear,Action complete = null)
{
LTRect cgrect = new LTRect();
cgrect.alpha = cg.alpha;
LTDescr d = LeanTween.alpha(cgrect, alpha, time).setEase(type);
d.setOnUpdate((float f) => { UpdateAlpha(cg, cgrect.alpha); });
if (complete != null)
{
d.setOnComplete(complete);
}
}
示例10: PlayAtPosition
public InPlayer PlayAtPosition(GameObject controllingObject, InAudioNode audioNode, Vector3 position, AudioParameters audioParameters, float fade = 0f, LeanTweenType fadeType = LeanTweenType.notUsed)
{
if (audioNode.IsRootOrFolder)
{
Debug.LogWarning("InAudio: Cannot play \"" + audioNode.GetName + "\" as it is a folder");
return null;
}
List<InstanceInfo> currentInstances = audioNode.CurrentInstances;
if (!AllowedStealing(audioNode, currentInstances))
return null;
var runtimePlayer = InAudioInstanceFinder.RuntimePlayerControllerPool.GetObject();
runtimePlayer.transform.position = position;
currentInstances.Add(new InstanceInfo(AudioSettings.dspTime, runtimePlayer));
Play(controllingObject, audioNode, runtimePlayer, fade, fadeType, audioParameters);
return runtimePlayer;
}
示例11: setLoopPingPong
public LTDescr setLoopPingPong(int loops)
{
this.loopType = LeanTweenType.pingPong;
this.loopCount = loops == -1 ? loops : loops * 2;
return this;
}
示例12: setRepeat
/**
* Set the tween to repeat a number of times.
* @method setRepeat
* @param {int} repeatNum:int the number of times to repeat the tween. -1 to repeat infinite times
* @return {LTDescr} LTDescr an object that distinguishes the tween
* @example
* LeanTween.moveX(gameObject, 5f, 2.0f ).setRepeat( 10 ).setLoopPingPong();
*/
public LTDescr setRepeat(int repeat)
{
this.loopCount = repeat;
if ((repeat > 1 && this.loopType == LeanTweenType.once) || (repeat < 0 && this.loopType == LeanTweenType.once))
{
this.loopType = LeanTweenType.clamp;
}
if (this.type == TweenAction.CALLBACK || this.type == TweenAction.CALLBACK_COLOR)
{
this.setOnCompleteOnRepeat(true);
}
return this;
}
示例13: StopAll
/// <summary>
/// Stop all sounds playing with fade out time
/// </summary>
/// <param name="gameObject"></param>
/// <param name="fadeOut">Time to fade out</param>
/// <param name="fadeType">Fade type</param>
public static void StopAll(float fadeOut, LeanTweenType fadeType)
{
if (instance != null)
{
instance._inAudioEventWorker.StopAll(fadeOut, fadeType);
}
else
{
InDebug.InstanceMissing("StopAll (fade)");
}
}
示例14: PlayAtPosition
/// <summary>
/// Play an audio node in world space with a custom fade, attached to another game object
/// </summary>
/// <param name="gameObject">The game object to attach to and be controlled by</param>
/// <param name="audioNode">The node to play</param>
/// <param name="position">The world position to play at</param>
/// <param name="fadeTime">How long it should take to fade in from 0 to 1 in volume</param>
/// <param name="tweeenType">The curve of fading</param>
/// <param name="startVolume">The starting volume</param>
/// <param name="endVolume">The end volume</param>
/// <param name="parameters">Parameters to set initial values directly</param>
/// <returns>A controller for the playing node</returns>
public static InPlayer PlayAtPosition(GameObject gameObject, InAudioNode audioNode, Vector3 position, float fadeTime, LeanTweenType tweeenType, float startVolume, float endVolume, AudioParameters parameters = null)
{
if (instance == null || audioNode == null || audioNode.IsRootOrFolder)
{
InDebug.MissingArguments("PlayAtPosition (tween specific)", gameObject, audioNode);
return null;
}
InPlayer player = instance._inAudioEventWorker.PlayAtPosition(gameObject, audioNode, position, parameters);
player.Volume = startVolume;
LTDescr tweever = LeanTween.value(gameObject, (f, o) => { (o as InPlayer).Volume = f; }, startVolume, endVolume, fadeTime);
tweever.onUpdateParam = player;
tweever.tweenType = tweeenType;
return player;
}
示例15: setRepeat
/**
* Set the tween to repeat a number of times.
* @method setRepeat
* @param {int} repeatNum:int the number of times to repeat the tween. -1 to repeat infinite times
* @return {LTDescr} LTDescr an object that distinguishes the tween
* @example
* LeanTween.moveX(gameObject, 5f, 2.0f ).setRepeat( 10 ).setLoopPingPong();
*/
public LTDescr setRepeat( int repeat )
{
this.loopCount = repeat;
if((repeat>1 && this.loopType == LeanTweenType.once) || (repeat < 0 && this.loopType == LeanTweenType.once)){
this.loopType = LeanTweenType.clamp;
}
return this;
}