本文整理汇总了C#中Tweener.Play方法的典型用法代码示例。如果您正苦于以下问题:C# Tweener.Play方法的具体用法?C# Tweener.Play怎么用?C# Tweener.Play使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tweener
的用法示例。
在下文中一共展示了Tweener.Play方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start()
{
_tweenparms = new TweenParms()
.Prop("rotation", new Vector3(0, 180, 0))
.Ease(EaseType.EaseInOutQuad)
.Loops(-1, LoopType.Yoyo);
_tweener = HOTween.To(this.transform, 4, _tweenparms);
_tweener.Play();
weapon.SetView(this);
}
示例2: ReachedEnd
//we reached the end of the path
internal IEnumerator ReachedEnd()
{
//we differ between all looptypes, because each one has a specific property
switch (looptype)
{
//LoopType.none means there will be no repeat,
//so we just discard the tweener and return
case LoopType.none:
tween.Kill();
tween = null;
PlayIdle();
yield break;
//in a loop we set our position indicator back to zero and start from the beginning
case LoopType.loop:
//additional option: if the path was closed, we move our object
//from the last to the first waypoint instead of just "appearing" there
if (closePath)
{
tween.Play();
PlayWalk();
yield return StartCoroutine(tween.UsePartialPath(currentPoint, -1).WaitForCompletion());
}
currentPoint = 0;
break;
//on LoopType.pingPong, we decrease our location indicator till it reaches zero again
//to start from the beginning - to achieve that, and differ between back and forth,
//we use the boolean "repeat" here and in NextWaypoint()
case LoopType.pingPong:
//discard tweener as it only moved us forwards or backwards
tween.Kill();
tween = null;
//we moved till the end of the path
if (!repeat)
{
//enable repeat mode
repeat = true;
//update waypoint positions backwards
for (int i = 0; i < wpPos.Length; i++)
{
wpPos[i] = waypoints[waypoints.Length - 1 - i].position + new Vector3(0, sizeToAdd, 0);
}
}
else
{
//we are at the first waypoint again,
//reinitialize original waypoint positions
//and disable repeating mode
InitWaypoints();
repeat = false;
}
//create tweener for next iteration
CreateTween();
break;
//on LoopType.random, we calculate a random order between all waypoints
//and loop through them, for this case we use the Fisher-Yates algorithm
case LoopType.random:
//reset random index, because we calculate a new order
rndIndex = 0;
//reinitialize original waypoint positions
InitWaypoints();
//discard tweener for new order
if (tween != null)
{
tween.Kill();
tween = null;
}
//create array with ongoing index numbers to keep them in mind,
//this gets shuffled with all waypoint positions at the next step
rndArray = new int[wpPos.Length];
for (int i = 0; i < rndArray.Length; i++)
{
rndArray[i] = i;
}
//get total array length
int n = wpPos.Length;
//shuffle wpPos and rndArray
while (n > 1)
{
int k = rand.Next(n--);
Vector3 temp = wpPos[n];
wpPos[n] = wpPos[k];
wpPos[k] = temp;
int tmpI = rndArray[n];
rndArray[n] = rndArray[k];
rndArray[k] = tmpI;
}
//.........这里部分代码省略.........