示例#1
0
        IEnumerator DoUpdate(float speed, Vector3 target)
        {
            animator.StartPlay();
            while (true)
            {
                transform.eulerAngles = startAngulars;
                if (target.x < transform.position.x)
                {
                    Vector2DUtils.Flip(transform);
                }
                while (transform.position != target)
                {
//					Log.Debug ("gooooo : {0},{1}",transform.position , target);
                    if (Vector2DUtils.IsOutsideScreen(transform.position, Direction2D.up))
                    {
//						Log.Debug ("{0} outof screen.",gameObject.name);
                        StopAct();
                        yield break;
                    }
                    if (!pausing)
                    {
                        Vector2DUtils.MoveToSmoothly(transform, target, speed);
                    }

                    yield return(null);
                }

                Vector2[] scope  = Vector2DUtils.GetScreenScope();
                float     xbound = render.bounds.size.x * .5f;
                float     rightX = scope [1].x + xbound + 10;
                float     leftX  = scope [0].x - xbound - 10;
                target.x = UnityEngine.Random.Range(leftX, rightX);
                target.y = UnityEngine.Random.Range(scope[0].y, scope[1].y);

//				Log.Debug ("move to new pos : {0}",target);
            }
        }
示例#2
0
文件: E2.cs 项目: imhazige/AeroEgg
 void Tracer_FlipingEvent(GuidMoveController param)
 {
     Vector2DUtils.Flip(transform);
 }