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


C# Tweener.Play方法代码示例

本文整理汇总了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);
    }
开发者ID:duytran,项目名称:Svelto-IoC-Example,代码行数:14,代码来源:WeaponView.cs

示例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;
                }

//.........这里部分代码省略.........
开发者ID:VillarGames,项目名称:RobotExtincion,代码行数:101,代码来源:hoMove.cs


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